This commit is contained in:
Mike Farah 2023-03-02 11:22:04 +11:00
parent 814a6114a8
commit f6fad90a48

View File

@ -407,8 +407,10 @@ A best attempt is made to copy comments to xml.
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml
#
# header comment # header comment
# above_cat # above_cat
#
cat: # inline_cat cat: # inline_cat
# above_array # above_array
array: # inline_array array: # inline_array
@ -427,7 +429,9 @@ will output
<!-- <!--
header comment header comment
above_cat above_cat
--><!-- inline_cat --><cat><!-- above_array inline_array --> -->
<!-- inline_cat -->
<cat><!-- above_array inline_array -->
<array>val1<!-- inline_val1 --></array> <array>val1<!-- inline_val1 --></array>
<array><!-- above_val2 -->val2<!-- inline_val2 --></array> <array><!-- above_val2 -->val2<!-- inline_val2 --></array>
</cat><!-- below_cat --> </cat><!-- below_cat -->
@ -489,7 +493,8 @@ yq -p=xml -o=xml '.' sample.xml
``` ```
will output will output
```xml ```xml
<!-- before cat --><cat><!-- in cat before --> <!-- before cat -->
<cat><!-- in cat before -->
<x>3<!-- multi <x>3<!-- multi
line comment line comment
for x --></x><!-- before y --> for x --></x><!-- before y -->