-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable Name with Hyphen Misinterpreted in Conditional Statements #307
Comments
@sai-prasad-1 Hello! |
I am using this package in Scala, and the variables are loaded from a YAML file as a HashMap and passed to the LIQP parser. I am able to access these variables using {{ }} in any template but not within any tags or blocks. // Convert the dataMap to Java Map for LIQP usage
val convertedDataMap = new util.HashMap[String, Any]()
dataMap.foreach { case (k, v) => convertedDataMap.put(k, v) }
innerMap.putAll(convertedDataMap)
siteVariables.put("site", innerMap)
val md = liqpParser.parse(rawMarkdown).render(siteVariables)
```
This is how the values are passed.
if you need anything else please let me know |
so in short what is the way to go around and solve or overcome the issue like i am using the JEKYLL flavour of liqp and the same thing is working over there in jekyl, and also as you mentioned the block is not considering the value as null/nill so is this something that could be fixed over time |
@sai-prasad-1 I see no other workaround then not use variables with minus in their names. Don't believe original Liquid/Jekyll will allow them either as it is invalid ruby identifier as well. |
I tried to workaround this with assign/capture, but their syntax also not allows such names. |
I am encountering an issue when trying to use a variable with a hyphen (-) in its name within a conditional statement in a markdown file. The variable loads and renders correctly using {{site.data.scam-banner}}, but when I attempt to use it within an if block or similar control structures, it throws an error. It appears that the hyphen in the variable name is being interpreted as a minus sign.
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) liqp.exceptions.LiquidException: parser error "mismatched input '-' expecting {TagEnd, '.', NEq, '==', '>=', '>', '<=', '<', '[', '?', 'contains', 'and', 'or'}" on line 7, index 29
is this an bug or does liqp not support this type of variables.
The text was updated successfully, but these errors were encountered: