-
Notifications
You must be signed in to change notification settings - Fork 942
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
Two shortcode problems #2564
Comments
The shortcode parser only handles valid shortcodes calls, eg We could make |
Ok. Let's put this in a broader context: many parsers do more than handle valid calls. Lots of parsers help the user with error recovery too. Second, given that |
We don't stop processing anything when we see only Maybe mimicking the syntax of Tera was not a good idea in practice since many people confuse shortcodes with macros because they kinda look the same. |
Bug Report
Correct behavior
To illustrate that my example is working... both of the following work:
{{ foobar() }}
{% foobar() %}x{% end %}
Both render the contents of
foobar.html
as expected. In the second case, the "x" is discarded, which makes sense, since there is no<body>
in thefootbar.html
.Incorrect behavior
{% foobar() %}{% end %}
does not render the shortcode. Instead, it renders itself; i.e.{% foobar() %}{% end %}
This should render the shortcode, just like
{{ foobar() }}
. Zola has the information it needs to do this.Unhelpful behavior
{% foobar() %}
renders itself; i.e.{% foobar() %}
This is virtually never what a user wants, so this behavior isn't helpful. I would suggest a "fail fast" error instead.
Instead, Zola could detect the missing end tag and offer a suggestion to either:
{{ foobar() }}
form{% end %}
tagContents of
foobar.html
:Environment
Zola version: zola 0.18.0
The text was updated successfully, but these errors were encountered: