Fixed CSV content starting with # issue #2076

This commit is contained in:
Mike Farah
2024-06-29 15:04:07 +10:00
parent 7e1722510a
commit 0b7d4b799c
4 changed files with 36 additions and 2 deletions
+11 -1
View File
@@ -95,10 +95,20 @@ func parseSnippet(value string) (*CandidateNode, error) {
if err != nil {
return nil, err
}
if result.Kind == ScalarNode {
result.LineComment = result.LeadingContent
} else {
result.HeadComment = result.LeadingContent
}
result.LeadingContent = ""
if result.Tag == "!!str" {
// use the original string value, as
// decoding drops new lines
return createScalarNode(value, value), nil
newNode := createScalarNode(value, value)
newNode.LineComment = result.LineComment
return newNode, nil
}
result.Line = 0
result.Column = 0