-
Notifications
You must be signed in to change notification settings - Fork 9
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
Control of white space - wider problem #69
Comments
I know that, HTML aside, this is being used in places to produce plain-text (for emails), and certainly don't want to regress any such usages that have relied on whitespace pass-through. (I've seen a Latex producing template too, even!) We could perhaps consider that declarative elements like |
One other thought I had: we could perhaps also have different defaults/settings on this depending on the language being produced. For example, if it's plain text or Latex, we'd not want HTML escaping either. Whitespace handling could also then maybe differ between these. |
For legacy reasons, the white space rules for a line would be as now, unless explicitly overwritten by a white space tag. |
In #68 I wrote specifically about white space after conditionals. The response there is that conditionals are special cased.
But white space control is a bit deeper for templating languages because there are two forms of white space, namely white space in the template (to help understanding the logic of the template), and white space in the rendered code (to help understanding of the rendered code).
Currently, Crotmp seems to preserve the whitespace in the template except for conditionals, in that conditionals generate no EOL if they produce no content. The same does not seem to be true of other tabs.
Perhaps it might be possible to have explicit white space tags, such as <_> for a space <_t> for a tab or 4 spaces and <_n> for a new line. These are rendered as white space.
Whitespace in the template would then ignored. This seems to me to be more Raku-ish, eg whitespace in a regex.
An example to illustrate the current situation is a template that defines a sub at the top of the template, then calls it later.
It is useful to separate the sub declaration from the rest of the template, but this leads to white space in the rendered template at the top of the file.
The text was updated successfully, but these errors were encountered: