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

Parser prefixes escape characters(\\) when the parameter is "$" #54

Open
aravindbaskaran opened this issue Oct 4, 2016 · 3 comments
Open

Comments

@aravindbaskaran
Copy link

aravindbaskaran commented Oct 4, 2016

Eg 1:

(clostache.parser/render "{{Currency}} {{Price}}" {:Currency "$" :Price 230})

Output:

"\\$ 230"

Expected:

"$ 230"

Eg 2:

(clostache.parser/render "{{Currency}} {{Price}}" {:Currency "USD$" :Price 230})

Output:

"USD\\$ 230"

Expected:

"USD$ 230"

@aravindbaskaran
Copy link
Author

This worked with {{&}} and {{{}}}

(clostache.parser/render "{{&Currency}} {{Price}}" {:Currency "$" :Price 230})

@aravindbaskaran
Copy link
Author

aravindbaskaran commented Oct 4, 2016

Sorry, suffered a brain freeze, had some extra code that was making it work

(->
  (clostache.parser/render "{{Currency}} {{Price}}" {:Currency "USD$" :Price 230})
  (clojure.string/replace  #"\\" ""))

That's the around. Thankfully no other "" characters are there in my template. Reopening

@aravindbaskaran
Copy link
Author

Another, better workaround

(clostache.parser/render "{{#CurrencyFn}}{{/CurrencyFn}} {{Price}}" {:Currency "USD$" :Price 230 :CurrencyFn #(str "$"%)})

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

1 participant