Refactored decoder responsibilities (#1402)

- improved comment handling
- yaml decoder now responsible for leading content work around
This commit is contained in:
Mike Farah
2022-10-28 14:16:46 +11:00
committed by GitHub
parent 46c32f4c79
commit 880397d549
42 changed files with 529 additions and 329 deletions
+5 -1
View File
@@ -386,6 +386,7 @@ A best attempt is made to copy comments to xml.
Given a sample.yml file of:
```yaml
# header comment
# above_cat
cat: # inline_cat
# above_array
@@ -402,7 +403,10 @@ yq -o=xml '.' sample.yml
```
will output
```xml
<!-- above_cat inline_cat --><cat><!-- above_array inline_array -->
<!--
header comment
above_cat
--><!-- inline_cat --><cat><!-- above_array inline_array -->
<array>val1<!-- inline_val1 --></array>
<array><!-- above_val2 -->val2<!-- inline_val2 --></array>
</cat><!-- below_cat -->