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

How to template a comment #63

Closed
finanalyst opened this issue Jan 10, 2022 · 1 comment
Closed

How to template a comment #63

finanalyst opened this issue Jan 10, 2022 · 1 comment

Comments

@finanalyst
Copy link

finanalyst commented Jan 10, 2022

An HTML comment has the form <!-- text -->

But <!-- also meets the non-alphabetic rule, so is not treated as content.

Perhaps <!-- should be special cased to be considered Content view text?

Also <! is used for conditionals. Perhaps

Currently if I have 'some stuff' in %params, how do I get a comment?
Given a file 'comment.crotmp' with contents

<!-- <.contents> -->

The following Raku code

my %parts;
my %params = ( :contents<this is it> );
dd %params;
say render-template('comment.crotmp', %params, :%parts);

Yields

<!-- <.contents> -->

I'm trying to get

<!-- this is it -->
@jnthn
Copy link
Member

jnthn commented Jan 10, 2022

You can work around this by <&HTML('<!--' ~ .contents ~ '-->')>. The parser does know not to confuse HTML comments with conditionals, and to emit them as comments, however it doesn't attempt to parse what is inside them. We could change that, however I do worry a little if it's been used for avoiding having JavaScript inside of <script> tags get considered as part of templating, and we'd thus break that if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants