Requiring closing link tag

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Requiring closing link tag

gorder
In HTML5 the closing tag is not required.

The problem I am running into is I am using Thymeleaf in combination with other front end build tools (gulp and company)

What is happening is I am injecting my combined and minified scripts/css into the thymeleaf templates.  Once this is done I am getting a SAX parse exception saying link tags require a closing </link> tag.

If I try to add a self closing tag <link />  it is getting stripped out by my build tools and made to be just <link>.  I cant really file a bug report against these other tools since actually with HTML5 the self closing tag is redundant.

Is there a way to make Thymeleaf not throw errors if self closing tags are not used (when mode is HTML5)
Reply | Threaded
Open this post in threaded view
|

Re: Requiring closing link tag

gorder
Looking more at it, probably wont be possible as it needs to also be valid XML for Thymeleaf to be able to parse it.
Reply | Threaded
Open this post in threaded view
|

Re: Requiring closing link tag

Zemi
Administrator
Hello,

you can use the legacy mode or wait for Thymeleaf 3.

To use the legacy mode just supply it to the configuration as "LEGACYHTML5", see
   http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#creating-and-configuring-the-template-engine

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Requiring closing link tag

gorder
Zemi,

Thanks for taking the time to respond. I did actually see that shortly after I posted.  I opted for fixing it with a regex replace on that particular HTML file further down the gulp pipeline, rather than using the legacy mode.  For the most part I like the validation that is provided it just bit me in this particular case it seems.

Can you expound a little on how Thymeleaf 3 will be different in the way it handles this?
Reply | Threaded
Open this post in threaded view
|

Re: Requiring closing link tag

Zemi
Administrator
There will be no more legacy modes in Thymeleaf 3, as the new parser is capable of managing any kind of ill-formed markup.

So the final output will be exactly as the original source regarding non-closed tags, attributes with no value or without quotes, single or double quotes, etc.

Regards,
   Zemi