preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Fix trimming whitespace around includes #531

Open preaction opened 7 years ago

preaction commented 7 years ago

When we use the include helper, we are often forced to have extra whitespace (even when using <%= include '...' %>. This can cause the Markdown to be rendered incorrectly, such as when building a list with includes as the values.

The normal Mojolicious syntax of using an = on the closing tag to trim whitespace works, but it trims all whitespace before and after, making Markdown render even more incorrectly.

We should try to do the right thing when including templates and not introduce any unexpected whitespace. If that's not possible, we should introduce a trim helper function that will at least trim whitespace around the include (while still allowing whitespace around the template directive itself), like <%= trim include '...' %>