Newlines within QUERY aren't retained (changed to spaces)
davidjb opened this issue · comments
It appears that newlines used within a QUERY
command get removed and/or replaced with a space upon parsing. The README mentions that a query would be passed unchanged to the resolver, but as shown below, newlines get affected. This presents an issue when these are important to the definition language, such as in YAML (as is my example), but these changes could affect any type of definition since a newline is being removed and/or changes to a space.
- A small reproducible example consisting of the code and .docx template you used:
{query
id: my_identifier
resource:
url: https://example.com/path.json
filter: "data[0].name == 'example'"
}
- A screenshot of the result you get and an explanation as to why this result is unexpected:
Debugging the command parsing with listCommands
yields the following CommandSummary
:
{ raw: `query id: my_identifier resource: url: https://example.com/path.json filter: "data[0].name == 'example'"`,
type: 'QUERY',
code: `id: my_identifier resource: url: https://example.com/path.json filter: "data[0].name == 'example'"` }
It appears the newlines/paragraphs have been removed and replaced with spaces, as indicated by the 3 spaces between resource: url:
– initially, there is a newline and 2 spaces indenting url:
but parsing results in this turning into 3 spaces. Just for assurances, I checked raw
and code
object properties above with .match(/\n/)
to ensure it wasn't just my terminal swallowing the newline and the match returns null
.
- Information about your compiler toolchain version (e.g. Angular, Webpack, etc.): Directly testing with ESM/Node script
- Information about your runtime environment (which browser, Electron, or NodeJS version): NodeJS v20.4.0, using
docx-templates
master from Git