Skip to content
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

Fully qualified keyword is not rendered in lambdas #19

Open
liquidz opened this issue Jul 17, 2022 · 2 comments
Open

Fully qualified keyword is not rendered in lambdas #19

liquidz opened this issue Jul 17, 2022 · 2 comments

Comments

@liquidz
Copy link

liquidz commented Jul 17, 2022

Expected

(pg/render-string "{{#f}}{{a/b}}{{/f}}" {:f #(str % " world")
                                         :a/b "hello"})
;; => "hello world"

Actual

(pg/render-string "{{#f}}{{a/b}}{{/f}}" {:f #(str % " world")
                                         :a/b "hello"})
;; => " world"

while (pg/render-string "{{#f}}{{foo}}{{/f}}" {:f #(str % " world") :foo "hello"}) returns "hello world"

@athos
Copy link
Owner

athos commented Jul 19, 2022

Thank you for reporting!

I'll look into it later, but I don't clearly remember if Pogonos was trying to fully support qualified keywords.
Also, I'm curious about how ambiguous keys like {{a.b/c.d}} should be interpreted. Should it be interpreted as equivalent to:

{{#a}}{{#b/c}}{{d}}{{/b/c}}{{/a}}

Or:

{{#a.b/c}}{{d}}{{/a.b/c}}

where a.b/c is a key qualified with the namespace a.b? (Or should it be taken as an atomic key a.b/c.d that can't be divided into smaller parts?) Do you have any thoughts on this?

@liquidz
Copy link
Author

liquidz commented Jul 19, 2022

Thanks for your confirmation!

Oh I forgot about dotted names...
It seems impossible to fully support fully qualified keyword since it cannot be interpreted uniquely.

In my opinion, fully qualified keyword is outside the specification of mustache, so dotted names should have priority.
Thus, if we support fully qualified keyword partially, {{a.b/c}} should be parsed to {{#a}}{{b/c}}{{/a}}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants