-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature request: comment syntax #21
Comments
Thanks for an issue.
For example, if we are using .someBlock
| %{forall paragraph <- lines paragraphs}
p.someBlock_paragraph
// This is comment syntax for pug
| \#{ paragraph }
| %{endforall} Even with a raw HTML, we can use comment like bellow example. <div class="someBlock">
%{forall paragraph <- lines paragraphs}
<p class="someBlock_paragraph">
<!-- This is comment syntax for html -->
\#{ paragraph }
</p>
%{endforall}
</div> Is this work for your intention? |
Yeah, I indeed am using that workaround. The result code contains the
comments and I thought it may deliver false intentions or things that I
don't want to expose to who can read the result code.
…On Sun, Mar 11, 2018 at 0:23 Kadzuya OKAMOTO ***@***.***> wrote:
Thanks for an issue.
Heterocephalus is supposed to be used with another template engine.
So, we can use comment syntax of the other template engine.
For example, if we are using pug, we can inject any comment as follows.
.someBlock
| %{forall paragraph <- lines paragraphs}
p.someBlock_paragraph // This is comment syntax for pug | \#{ paragraph }
| %{endforall}
Even with a raw HTML, we can use comment like bellow example.
<div class="someBlock">
%{forall paragraph <- lines paragraphs}
<p class="someBlock_paragraph">
<!-- This is comment syntax for html -->
\#{ paragraph }
</p>
%{endforall}
</div>
Is this works for your intention?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAwj2Pv3VD1d24KxifiAnN_zSf_X4fmks5tc_AEgaJpZM4Sk2_u>
.
|
Note, for comparison, Hamlet supports one-line comments prefixed with `$#`.
I'm not sure it's documented, and I might have sigils in reverse order, but
there are definitely Hamlet-level comments. :)
…On Mar 10, 2018 11:02, "Hong Minhee" ***@***.***> wrote:
Yeah, I indeed am using that workaround. The result code contains the
comments and I thought it may deliver false intentions or things that I
don't want to expose to who can read the result code.
On Sun, Mar 11, 2018 at 0:23 Kadzuya OKAMOTO ***@***.***>
wrote:
> Thanks for an issue.
>
> Heterocephalus is supposed to be used with another template engine.
> So, we can use comment syntax of the other template engine.
>
> For example, if we are using pug, we can inject any comment as follows.
>
> .someBlock
> | %{forall paragraph <- lines paragraphs}
> p.someBlock_paragraph // This is comment syntax for pug | \#{ paragraph }
> | %{endforall}
>
> Even with a raw HTML, we can use comment like bellow example.
>
> <div class="someBlock">
> %{forall paragraph <- lines paragraphs}
> <p class="someBlock_paragraph">
> <!-- This is comment syntax for html -->
> \#{ paragraph }
> </p>
> %{endforall}
> </div>
>
> Is this works for your intention?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#21#
issuecomment-372037891>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-
auth/AAAwj2Pv3VD1d24KxifiAnN_zSf_X4fmks5tc_AEgaJpZM4Sk2_u>
> .
>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAg3qsdb6J4ux-hS6j8sC0ENy-8aTDCpks5tc_kOgaJpZM4Sk2_u>
.
|
@dahlia Thanks. It makes sense! <div class="someBlock">
%{forall paragraph <- lines paragraphs}
<p class="someBlock_paragraph">
\#{ comment "This is a comment." }
\#{ paragraph }
</p>
%{endforall}
</div> comment :: String -> String
comment = const "" |
@chreekat Thanks for helpful information. I do not want to introduce new syntaxes by the reason of just convenience because it is easy to add new feature but it is difficult to remove it after released it. |
This point would be best made with concrete examples. @dahlia, do you have any to share? I will look to see if I have any, also. |
Is there any opinions, @dahlia ? |
Actually I use Heterocephalus for generating Python and JavaScript codes. As they both have their own comments, I currently stick with a workround mentioned above. The problem is that its content is out of scope and merely nonsense for people who read the generated codes. |
Thanks. |
Although using a no-op function barely works, since its syntax is quite picky (e.g., need to escape a double quote), I personally am not likely to use that. |
OK. It makes sense. @dahlia , are you interested in taking a stab at a PR? |
I meant if you are not interested in creating PR by yourself, I'll do it by myself. |
Sorry for the late response. I would appreciate if you're going to add the own comment syntax to Heterocephalus. 😄 |
Thanks for response! |
Sometimes we need to explain the intention of a templating code. Comments can be useful for such situations. Though I have no idea how the comment syntax should look like.
The text was updated successfully, but these errors were encountered: