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

Complex template not working #7

Closed
trojanh opened this issue Jul 30, 2020 · 3 comments · Fixed by #29
Closed

Complex template not working #7

trojanh opened this issue Jul 30, 2020 · 3 comments · Fixed by #29

Comments

@trojanh
Copy link
Contributor

trojanh commented Jul 30, 2020

Thanks for this lightweight library.
Not sure if this is intended to be used this way, but reporting it anyway for future readers as it's not mentioned in the docs.

Consider the following template

const template = `<ApplicantFirstName>{{it.firstName}}</ApplicantFirstName>`

When we use the following, it.firstName is replaced by ''

Eta.render(template, { firstName: "ABC" }, { tags: ["{{", "}}"])

output is:

`<ApplicantFirstName></ApplicantFirstName>`

Package & Environment Details

  • Environment: Node
  • Version: latest
@nebrelbug
Copy link
Collaborator

Hey @trojanh, thanks for the report! Actually, your template should look like {{=it.firstName}} instead of {{it.firstName}}.

The issue stumped me for a while -- I'm so used to the syntax of template engines that use {{ ... }} like Squirrelly and Handlebars that I forgot Eta needed the = after the opening tag 🤣!

Thanks for taking the time to create the issue -- let me know if you have any questions 👍

@trojanh
Copy link
Contributor Author

trojanh commented Aug 3, 2020

Thanks @nebrelbug , I think I must have overlooked this.

Any way if you really feel this is so easy to mistake, we must add some highlight for this. I had checked all the docs but I missed this silly thing. 😅

I think you have done great job keeping this library lightweight yet so feature rich and also well documented 🙏

I would love to help you with anything.

@trojanh trojanh closed this as completed Aug 3, 2020
@nebrelbug
Copy link
Collaborator

@trojanh no problem, glad I could help!

Yeah, highlighting would be super helpful. I've also considered making a linting plugin that would loop through the parse results and identify likely errors.

Thanks so much! I've really enjoyed creating Eta.

I would love to help you with anything.

Thanks! If you want, you could write a tutorial explaining how to use Eta or talking about the benefits of Eta (I'd point users to it from the docs). Otherwise, just using Eta, asking questions, and filing issues is helpful!

trojanh added a commit to trojanh/eta that referenced this issue Sep 18, 2020
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

Successfully merging a pull request may close this issue.

2 participants