Because browsers add space between certain elements when there is space around their tags in the HTML, sometimes writing raw HTML you'd do something like this:
<p> To learn more, click <a href="...">this link</a>. </p>
Note the lack of whitespace between the ending anchor tag and the punctuation.
However, when generating HTML via a Cro template, getting this effect becomes unwieldy. Consider the following:
<p>
<@.elements>
<?{ .type eq 'text' }>
<.text>
</?>
<!?{ .type eq 'link' } a href="<.target>">
<.link-text>
</?>
</@>
</p>
To have punctuation immediately next to an anchor tag, we'd have to scrunch this code mostly onto one line. Otherwise, the spacing in the source crotmp file gets preserved in the generated HTML. Might I suggest a backslash to render any amount of following whitespace "insignificant"?
<!?{ .type eq 'link' } a href="<.target>">\
<.link-text>\
</?>\
Some kind of "auto-minify" setting on the template render call might be nice as well, but less granular.
Because browsers add space between certain elements when there is space around their tags in the HTML, sometimes writing raw HTML you'd do something like this:
Note the lack of whitespace between the ending anchor tag and the punctuation.
However, when generating HTML via a Cro template, getting this effect becomes unwieldy. Consider the following:
To have punctuation immediately next to an anchor tag, we'd have to scrunch this code mostly onto one line. Otherwise, the spacing in the source crotmp file gets preserved in the generated HTML. Might I suggest a backslash to render any amount of following whitespace "insignificant"?
Some kind of "auto-minify" setting on the template render call might be nice as well, but less granular.