8000 Template should not evaluate outside the templating expression marks (eg `{{ }}`) · Issue #723 · configu/configu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Template should not evaluate outside the templating expression marks (eg {{ }}) #723
@dipsywong98

Description

@dipsywong98

Current Behavior

With my previous experience working with templating stuff, the evaluation of values should only happen between {{ }}, and outside the {{ }} should remain untouched/unchanged, however it is not the case in configu.

For example I have a file back-tick.txt, its content is just

`

Run configu eval | configu export --template examples/back-tick.txt it will give

configu eval | configu export --template examples/back-tick.txt 
│
◇  Configs evaluated successfully
│
■  template expression evaluation failed: Error: Failed to evaluate expression "````"
│  "" is not a function

which it is expected to just give

`

Currently we need to prepend \ before to give the expected content, which is counter intuitive.

Another example is \n

For example we have a line-break.json

{
  "title": "Hello",
  "paragraph": "{{$.configs.MESSAGE.value}}\nIt is a nice day"
}

configu eval | configu export --template examples/line-break.json it gives the following, which breaks the json syntax

{
  "title": "Hello",
  "paragraph": "Hi there!
It is a nice day"
}

which I expect it gives the following instead, that does not evaluate the line break character

{
  "title": "Hello",
  "paragraph": "Hi there!\nIt is a nice day"
}

Now I need to add extra \ to avoid \n being evaluated, which is not supposed to be a templating engine's behavior

{
  "title": "Hello",
  "paragraph": "{{$.configs.MESSAGE.value}}\\nIt is a nice day"
}

Expected Behavior

it is in above

To Reproduce

No response

Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcommunitytriageThe issue is new and needs to be triaged by a maintainer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0