Hi, Is there a way to insert into a page real HTML comments ? I mean, HTML-style comments like <!-- ... --> are stripped on rendering the page. I'd like to insert comments staying as comments in the source code of the generated page.
Thanks, Sylvain Brunerie – [[fr:User:Delhovlyn]]
On Fri, Nov 14, 2008 at 03:40, Sylvain Brunerie sylvain.brunerie@gmail.com wrote:
Is there a way to insert into a page real HTML comments ? ... I'd like to insert comments staying as comments in the source code of the generated page.
<span style="display:none">comment</span> works pretty well and can satisfy most reasons for inserting a comment into a page.
— Kalan
Hmm, this can be a way to get around the problem... =) But this has inconvenients. Isn't there any wikisyntax to do this, to write really HTML comments ? For the syntax highlighting of the source code in FF, for example, it would be important. Or maybe we can request this feature ?
2008/11/13 Kalan kalan.001@gmail.com
On Fri, Nov 14, 2008 at 03:40, Sylvain Brunerie sylvain.brunerie@gmail.com wrote:
Is there a way to insert into a page real HTML comments ? ... I'd like to insert comments staying as comments in the source code of the generated page.
<span style="display:none">comment</span> works pretty well and can satisfy most reasons for inserting a comment into a page.
— Kalan _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Fri, Nov 14, 2008 at 03:53, Sylvain Brunerie sylvain.brunerie@gmail.com wrote:
Isn't there any wikisyntax to do this, to write really HTML comments ?
No, for now.
For the syntax highlighting of the source code in FF, for example, it would be important.
There is a <source> tag...
Or maybe we can request this feature ?
Sure we can, it shouldn't be hard in any way.
— Kalan
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, Nov 13, 2008 at 9:57 PM, Kalan wrote:
Isn't there any wikisyntax to do this, to write really HTML comments ?
Or maybe we can request this feature ?
Sure we can, it shouldn't be hard in any way.
I take a look at it when I finish my physics exam on Monday. Any syntax suggestions? I'd propose <htmlcomment></htmlcomment>. Or would anyone here like to not strip <!-- -->s any more?
Marco
2008/11/13 Marco Schuster marco@harddisk.is-a-geek.org
I take a look at it when I finish my physics exam on Monday. Any syntax suggestions? I'd propose <htmlcomment></htmlcomment>. Or would anyone here like to not strip <!-- -->s any more?
Marco
Thanks. =) Concerning the syntax, I was rather thinking about something more concise, similar to <!-- --> but different.
Sylvain Brunerie schreef:
I take a look at it when I finish my physics exam on Monday. Any syntax suggestions? I'd propose <htmlcomment></htmlcomment>. Or would anyone here like to not strip <!-- -->s any more?
Marco
Thanks. =) Concerning the syntax, I was rather thinking about something more concise, similar to <!-- --> but different.
That would be significantly harder to implement, and also potentially confusing. Writing an extension that implements <comment></comment> is ridiculously easy, whereas introducing new syntax of another kind would be very hard on pretty much everyone whose name isn't Tim Starling :)
Roan Kattouw (Catrope)
On Thu, Nov 13, 2008 at 10:09 PM, Roan Kattouw roan.kattouw@home.nl wrote:
Sylvain Brunerie schreef:
I take a look at it when I finish my physics exam on Monday. Any syntax suggestions? I'd propose <htmlcomment></htmlcomment>. Or would anyone here like to not strip <!-- -->s any more?
Marco
Thanks. =) Concerning the syntax, I was rather thinking about something more concise, similar to <!-- --> but different.
That would be significantly harder to implement, and also potentially confusing. Writing an extension that implements <comment></comment> is ridiculously easy, whereas introducing new syntax of another kind would be very hard on pretty much everyone whose name isn't Tim Starling :)
another idea for comments:
<script>// Looks mom, no hands! </script>
<script>/* This is not a TEST, i am inocent */ </script>
now, for "example source code", theres the good old XMP
<xmp> what you see is what you see, YO!. FR<BR>UK that is, brasil is better than anyone </xmp>
Roan Kattouw wrote:
That would be significantly harder to implement, and also potentially confusing. Writing an extension that implements <comment></comment> is ridiculously easy, whereas introducing new syntax of another kind would be very hard on pretty much everyone whose name isn't Tim Starling :)
Roan Kattouw (Catrope)
Agree. Much better to add a <htmlcomment> and changing it to a shorter name if needed would be trivial.
Now, some implementation details: What to with a --> inside a html comment? And -- ?
On Thu, 13 Nov 2008 22:53:15 +0100, Platonides wrote:
Roan Kattouw wrote:
That would be significantly harder to implement, and also potentially confusing. Writing an extension that implements <comment></comment> is ridiculously easy, whereas introducing new syntax of another kind would be very hard on pretty much everyone whose name isn't Tim Starling :)
Roan Kattouw (Catrope)
Agree. Much better to add a <htmlcomment> and changing it to a shorter name if needed would be trivial.
Now, some implementation details: What to with a --> inside a html comment? And -- ?
Well, <source lang=html4strict><!-- comment --></source> seems to work like I'd expect, so the normal extension handling should get it right. Strip <comment>, remove <!-- .. -->, unstrip <comment>
Steve Sanbeg schreef:
On Thu, 13 Nov 2008 22:53:15 +0100, Platonides wrote:
Roan Kattouw wrote:
That would be significantly harder to implement, and also potentially confusing. Writing an extension that implements <comment></comment> is ridiculously easy, whereas introducing new syntax of another kind would be very hard on pretty much everyone whose name isn't Tim Starling :)
Roan Kattouw (Catrope)
Agree. Much better to add a <htmlcomment> and changing it to a shorter name if needed would be trivial.
Now, some implementation details: What to with a --> inside a html comment? And -- ?
Well, <source lang=html4strict><!-- comment --></source> seems to work like I'd expect, so the normal extension handling should get it right. Strip <comment>, remove <!-- .. -->, unstrip <comment>
Hmm, that's starting to sound scary. Doesn't <nowiki><!-- comment --></nowiki> work? If it doesn't, we could ask Tim to make it work (shouldn't be too hard).
Roan Kattouw (Catrope)
On Thu, 13 Nov 2008 23:40:04 +0100, Roan Kattouw wrote:
Steve Sanbeg schreef:
On Thu, 13 Nov 2008 22:53:15 +0100, Platonides wrote:
Roan Kattouw wrote:
That would be significantly harder to implement, and also potentially confusing. Writing an extension that implements <comment></comment> is ridiculously easy, whereas introducing new syntax of another kind would be very hard on pretty much everyone whose name isn't Tim Starling :)
Roan Kattouw (Catrope)
Agree. Much better to add a <htmlcomment> and changing it to a shorter name if needed would be trivial.
Now, some implementation details: What to with a --> inside a html comment? And -- ?
Well, <source lang=html4strict><!-- comment --></source> seems to work like I'd expect, so the normal extension handling should get it right. Strip <comment>, remove <!-- .. -->, unstrip <comment>
Hmm, that's starting to sound scary. Doesn't <nowiki><!-- comment --></nowiki> work? If it doesn't, we could ask Tim to make it work (shouldn't be too hard).
Roan Kattouw (Catrope)
This doesn't seem scary, but I really should read the new preprocessor more thoroughly. Anyway, it seems like both <!--<nowiki>-->''text''<!--</nowiki>-->
and
<nowiki><!-- comment --></nowiki>
work properly, so nesting and comments doesn't seem to be much of an issue.
Steve Sanbeg schreef:
Anyway, it seems like both
<!--<nowiki>-->''text''<!--</nowiki>-->
and
<nowiki><!-- comment --></nowiki>
work properly, so nesting and comments doesn't seem to be much of an issue.
If the latter works properly, then why are we even considering a <comment> tag? Does <nowiki><!-- comment --></nowiki> work properly in the sense that comments are stripped after <nowiki> tags are parsed, so you'll actually get a comment in the HTML output?
Roan Kattouw (Catrope)
On Fri, Nov 14, 2008 at 8:53 AM, Platonides Platonides@gmail.com wrote:
Agree. Much better to add a <htmlcomment> and changing it to a shorter name if needed would be trivial.
Now, some implementation details: What to with a --> inside a html comment? And -- ?
Forgive me for asking the obvious, but why on Earth do we want to be able to insert HTML comments? Comments are used in markup/programming languages, and are for the benefit of those who edit the code subsequently. Of course, nobody edits the parsed HTML, at least not directly, so it doesn't make much sense to put comments in there.
Step back from implementation, and first ask "What's the use case?" Without a use case, you can't hope to think of a sensible implementation, because so much of implementation depends on how the feature is to be used.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Andrew Garrett wrote:
Forgive me for asking the obvious, but why on Earth do we want to be able to insert HTML comments? Comments are used in markup/programming languages, and are for the benefit of those who edit the code subsequently. Of course, nobody edits the parsed HTML, at least not directly, so it doesn't make much sense to put comments in there.
Step back from implementation, and first ask "What's the use case?" Without a use case, you can't hope to think of a sensible implementation, because so much of implementation depends on how the feature is to be used.
The one case I might think of is microformats that make use of comments... but that's bad practice, since parsers can legitimately strip comments. :D
- -- brion
There is a <source> tag...
No, I mean, when I do Ctrl+U in Firefox, to see the source code of a page, I want to see my "real HTML comments" like real HTML comments, green italic. =)
Sure we can, it shouldn't be hard in any way.
I'll think about this. (I didn't found anything similar on Bugzilla.)
Sylvain Brunerie
On Fri, Nov 14, 2008 at 04:02, Sylvain Brunerie sylvain.brunerie@gmail.com wrote:
There is a <source> tag...
No, I mean, when I do Ctrl+U in Firefox, to see the source code of a page, I want to see my "real HTML comments" like real HTML comments, green italic. =)
Ahh, this... I thought it was a Firefox-specific feature that I didn't know of, not a thing available in any major browser. :)
On Fri, Nov 14, 2008 at 04:00, Marco Schuster marco@harddisk.is-a-geek.org wrote:
I take a look at it when I finish my physics exam on Monday. Any syntax suggestions? I'd propose <htmlcomment></htmlcomment>. Or would anyone here like to not strip <!-- -->s any more?
Stripping <!-- -->s conserves bytes for transclusion, when used in templates, and occasional stripping turnoff may break things. <htmlcomment></htmlcomment> or, perhaps, <comment></comment> is a better and easier-to-implement option.
— Kalan
On Thu, Nov 13, 2008 at 3:40 PM, Sylvain Brunerie sylvain.brunerie@gmail.com wrote:
Is there a way to insert into a page real HTML comments ? I mean, HTML-style comments like <!-- ... --> are stripped on rendering the page. I'd like to insert comments staying as comments in the source code of the generated page.
No, there absolutely is not. That would be unsafe: users could insert arbitrary HTML content in comments and have IE pick it up using IE conditionals. If there were an actual use-case that was of any value, we could strip IE conditional comments and let all others pass . . . which would be safe only assuming there are no other scary abuses of comments out there, and that we get the conditional comment stripping right. If there are no use-cases, it's not worth it.
2008/11/14 Aryeh Gregor <Simetrical+wikilist@gmail.comSimetrical%2Bwikilist@gmail.com
That would be unsafe: users could insert arbitrary HTML content in comments and have IE pick it up using IE conditionals. If there were an actual use-case that was of any value, we could strip IE conditional comments and let all others pass . . . which would be safe only assuming there are no other scary abuses of comments out there, and that we get the conditional comment stripping right. If there are no use-cases, it's not worth it.
That's true. I didn't know these conditional comments for IE.
Sylvain Brunerie wrote:
Hi, Is there a way to insert into a page real HTML comments ? I mean, HTML-style comments like <!-- ... --> are stripped on rendering the page. I'd like to insert comments staying as comments in the source code of the generated page.
The main reason why comments are completely removed, rather than replaced with a marker and later re-inserted, is that in various contexts, users expect comments to have no syntactical impact whatsoever, and a strip marker would interfere with this, without invasive changes to many points of the parser. For instance:
{{ #if: <!-- param empty? --> {{{param|}} | yes | no }}
The comment is removed, which means that the parameter interacts with the #if in an intuitive way.
This behaviour provides a challenge for the pre-save transform (PST), where templates are required to be expanded, and comments are re-inserted unchanged. The current situation with the PST is that comments are completely removed in certain safe special cases, with bugs exposed in the remaining cases.
There's no reason why an extension couldn't add an xmlish tag, like <htmlcomment>, which inserts an HTML comment and protects against IE conditional comments and similar constructs as appropriate. But unless someone can come up with an important application, I don't think it needs to be in the core.
-- Tim Starling
On Tue, Nov 18, 2008 at 8:51 AM, Tim Starling tstarling@wikimedia.orgwrote: ...
There's no reason why an extension couldn't add an xmlish tag, like <htmlcomment>, which inserts an HTML comment and protects against IE conditional comments and similar constructs as appropriate. But unless someone can come up with an important application, I don't think it needs to be in the core.
Idea:
I don't know any important application. But any code lenguaje benefict from a system to make comment*. Like, maybe the sysntax is hard or you want to make a cavet for others.
What maybe is not need, is to generate a output of that comments. So <comment>This template url is broken, don't change it</comment> resulting in "" (nothing) on the html output. That way you also avoid evil uses of comments, like IE conditionals. Or "invisible comments edit wars".
*: Even the ugly SQL support comments, so,... why no the wiki sintax?
Tei wrote:
On Tue, Nov 18, 2008 at 8:51 AM, Tim Starling tstarling@wikimedia.orgwrote: ...
There's no reason why an extension couldn't add an xmlish tag, like <htmlcomment>, which inserts an HTML comment and protects against IE conditional comments and similar constructs as appropriate. But unless someone can come up with an important application, I don't think it needs to be in the core.
Idea:
I don't know any important application. But any code lenguaje benefict from a system to make comment*. Like, maybe the sysntax is hard or you want to make a cavet for others.
What maybe is not need, is to generate a output of that comments. So <comment>This template url is broken, don't change it</comment> resulting in "" (nothing) on the html output. That way you also avoid evil uses of comments, like IE conditionals. Or "invisible comments edit wars".
*: Even the ugly SQL support comments, so,... why no the wiki sintax?
We have such a feature already, the syntax is <!-- -->, like in HTML.
-- Tim Starling
wikitech-l@lists.wikimedia.org