Compare commits

..
Author SHA1 Message Date
Mike Farah 46a419aad6 it works! 2022-01-15 11:40:05 +11:00
Mike Farah deee3c1f60 xml wip 2022-01-15 11:25:56 +11:00
Mike Farah 4c47f43251 Merge branch 'master' into xml-comments 2022-01-15 10:42:25 +11:00
Mike Farah 3c7ccf0bc4 wip 2022-01-02 13:44:31 +11:00
Mike Farah e16167ff26 wip 2022-01-02 13:42:47 +11:00
Mike Farah eaeeffe417 wip 2022-01-02 12:51:30 +11:00
Mike Farah 4b0cd5335b tests passing! 2022-01-01 12:34:15 +11:00
Mike Farah 60b4840a20 wip 2022-01-01 12:24:44 +11:00
Mike Farah 8c512dcc40 wip 2021-12-31 19:58:39 +11:00
Mike Farah cdd2a90a98 wip 2021-12-31 12:50:16 +11:00
Mike Farah 2529a4708a wip 2021-12-31 12:36:59 +11:00
Mike Farah 277ba1fe5d wip 2021-12-30 15:39:40 +11:00
Mike Farah 2c4bd03ec6 wip 2021-12-30 14:13:31 +11:00
Mike Farah d105efbcf1 wip refactoring printer 2021-12-22 12:22:29 +11:00
Mike Farah 9c6d84d184 wip xml encoding 2021-12-22 11:58:52 +11:00
Mike Farah e869f4b81f wip better comment parsing 2021-12-22 11:39:10 +11:00
Mike Farah a72743f9c9 wip better comment parsing 2021-12-22 11:31:28 +11:00
Mike Farah 0881ce2476 wip 2021-12-21 18:07:37 +11:00
Mike Farah 4d9583d1ee wip 2021-12-21 17:59:44 +11:00
3 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ See https://mikefarah.gitbook.io/yq/ for detailed documentation and examples.`,
}
rootCmd.PersistentFlags().StringVarP(&outputFormat, "output-format", "o", "yaml", "[yaml|y|json|j|props|p|xml|x] output format type.")
rootCmd.PersistentFlags().StringVarP(&inputFormat, "input-format", "p", "yaml", "[yaml|y|xml|x] parse format for input. Note that json is a subset of yaml.")
rootCmd.PersistentFlags().StringVarP(&inputFormat, "input-format", "p", "yaml", "[yaml|y|xml|x] input format type. Note that json is a subset of yaml.")
rootCmd.PersistentFlags().StringVar(&xmlAttributePrefix, "xml-attribute-prefix", "+", "prefix for xml attributes")
rootCmd.PersistentFlags().StringVar(&xmlContentName, "xml-content-name", "+content", "name for xml content (if no attribute name is present).")
+2
View File
@@ -5,6 +5,8 @@ import (
"fmt"
"io"
"strings"
// "strings"
"unicode"
"golang.org/x/net/html/charset"
+2
View File
@@ -49,10 +49,12 @@ func (e *xmlEncoder) Encode(writer io.Writer, node *yaml.Node) error {
return err
}
case yaml.DocumentNode:
log.Debugf("ENCODING DOCUMENT NODE")
err := e.encodeComment(encoder, headAndLineComment(node))
if err != nil {
return err
}
log.Debugf("OK NOW THE ACTUAL")
err = e.encodeTopLevelMap(encoder, unwrapDoc(node))
if err != nil {
return err