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

Feature request: Add text element support #22

Closed
a-h opened this issue Oct 2, 2021 · 0 comments
Closed

Feature request: Add text element support #22

a-h opened this issue Oct 2, 2021 · 0 comments

Comments

@a-h
Copy link
Owner

a-h commented Oct 2, 2021

Currently, to output some text, you have to remember to use a variable.

{% templ BasicTemplate() %}
  <div>{%= "Name" %}</div>
{% endtempl %}

I forget sometimes, and write this code:

{% templ BasicTemplate() %}
  <div>Name</div>
{% endtempl %}

And receive the error:

Generated code for 1 templates with 1 errors in 911.881µs
1 error occurred:
        * template.templ: template.templ parsing error: <div>: expected end tag not present or invalid tag contents at line 12, col 8 (index 178)

Improving the parser to parse HTML encoded text elements would complicate the code, but make a better developer experience, and lead to simpler templates.

@a-h a-h closed this as completed in 4eb4878 Oct 10, 2021
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