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

assignVar helper does not work with SafeString #139

Open
peterrakmanyi opened this issue Jun 10, 2021 · 1 comment
Open

assignVar helper does not work with SafeString #139

peterrakmanyi opened this issue Jun 10, 2021 · 1 comment

Comments

@peterrakmanyi
Copy link

peterrakmanyi commented Jun 10, 2021

  1. All the helpers with a string output actually return a SafeString object.
  2. Not all helpers that accept a string input work with SafeString.
  • custom helper: {{assignVar "foo" (concat "b" "ar")}} results in error:
    assignVar helper value must be a string or a number (integer)

  • standard helper: {{trim (concat "b" "ar")}} fails to default "" empty string

  1. There is no helper to get a string from SafeString.
@peterrakmanyi
Copy link
Author

It appears that there is a workaround with using the get helper like this:
{{get 'string' (concat "b" "ar")}} results in "bar"

...

{{assignVar "foo" (get 'string' (concat "b" "ar"))}} does result in var foo="bar"

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

No branches or pull requests

1 participant