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

User-defined tags fail to parse when inside an #include template section #8662

Closed
benkard opened this issue Apr 17, 2020 · 0 comments · Fixed by #8720
Closed

User-defined tags fail to parse when inside an #include template section #8662

benkard opened this issue Apr 17, 2020 · 0 comments · Fixed by #8720
Assignees
Labels
area/qute The template engine kind/bug Something isn't working
Milestone

Comments

@benkard
Copy link
Contributor

benkard commented Apr 17, 2020

Describe the bug
Given a user-defined tag hello and a template base, an attempt to parse a file foo.txt containing {#include base}{#item}{#hello name=name /}{/item}{/include} as a template fails with the following exception:

io.quarkus.qute.TemplateException: Parser error in template [foo.txt] on line 1: section block end tag [item] does not match the start tag [hello]
	at io.quarkus.qute.Parser.parserError(Parser.java:394)
	at io.quarkus.qute.Parser.flushTag(Parser.java:345)
	at io.quarkus.qute.Parser.tag(Parser.java:198)
	at io.quarkus.qute.Parser.processCharacter(Parser.java:149)
	at io.quarkus.qute.Parser.parse(Parser.java:106)
	at io.quarkus.qute.EngineImpl.load(EngineImpl.java:135)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at io.quarkus.qute.EngineImpl.getTemplate(EngineImpl.java:109)
	at io.quarkus.qute.deployment.QuteProcessor.analyzeTemplates(QuteProcessor.java:224)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:931)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2027)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1551)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1442)
	at java.base/java.lang.Thread.run(Thread.java:832)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Expected behavior
There is no parse error. The {#hello name=name /} part of the template acts the same as its manual substitution.

Actual behavior
The template cannot be parsed and throws an exception instead. See above.

To Reproduce

  1. Check out this branch: https://github.com/benkard/quarkus/tree/mulk/work/qute-user-tag-in-include-template
  2. Run this unit test: https://github.com/benkard/quarkus/blob/mulk/work/qute-user-tag-in-include-template/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/tag/UserTagIncludeTest.java, e.g. by running mvn verify -pl extensions/qute/deployment -am -Dtest=io.quarkus.qute.deployment.tag.UserTagIncludeTest -DfailIfNoTests=false

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin 19.4.0
  • Output of java -version: OpenJDK Runtime Environment Zulu14.27+1-CA (build 14+36)
  • Quarkus version or git rev: af5b3be65ef24f838f5d8aac48beaf20a51c1767
  • Build tool: Apache Maven 3.6.3

Additional context

@benkard benkard added the kind/bug Something isn't working label Apr 17, 2020
@geoand geoand added the area/qute The template engine label Apr 18, 2020
@mkouba mkouba self-assigned this Apr 21, 2020
mkouba added a commit to mkouba/quarkus that referenced this issue Apr 21, 2020
@gsmet gsmet added this to the 1.4.0.Final milestone Apr 21, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 21, 2020
gytis pushed a commit to gytis/quarkus that referenced this issue Apr 22, 2020
benkard added a commit to benkard/mulkcms2 that referenced this issue Sep 4, 2021
Also adds a workaround for Quarkus issue #8662
(quarkusio/quarkus#8662).

Change-Id: I0a91a67609b0fce4cf7f4dd356d787caf1e2938d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/qute The template engine kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants