Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
TagCommenting
Another old feature request idea, but with some strong movement on 4.1 maybe it’s time to give it more focus :)
Add the ability to add comments in Textpattern’s code: page, forms, CSS, etc.
Those comments won’t be parsed by Textpattern, and thus won’t appear on any html or css source code in the frontend.
With increasing complexity of pages and forms, I often find myself (and I know I’m not the only one) in need of putting some comment here; or the other way around going back to a TXP site I haven’t touched in the backend for a year or two, hammering my head trying to understand why I did this that way.
Right now the only workaround is a
<txp:php>/* some comment */</txp:php>
which is ugly and complex :-(
Last edited by Jeremie (2007-06-12 18:30:05)
Offline
Re: TagCommenting
Offline
Re: TagCommenting
Yup, I missed this one. That’s nice for my personal use, but I do think commenting should be in the core.
Plugins and their syntax don’t show up in the tag generator, nor the documentation, and have different syntax.
And the classic <txp:code>...</txp:code>
syntax seems ok for a big comment block, not for small but recurrent usage.
I was aiming more for something like the classical // in languages (maybe not that one especially, but something equally simple).
Last edited by Jeremie (2007-06-12 19:05:55)
Offline
Re: TagCommenting
Please elaborate on a possible comment delimiter pair/single line comment introduction.
Offline
Re: TagCommenting
For a delimiter pair, how about:
{!-- unparsed comment goes here --}
Last edited by reid (2007-06-12 20:47:41)
TextPattern user since 04/04/04
Offline
Re: TagCommenting
For a delimiter pair, why not use a variation on the standard? For example: //* ... *//
?
However, for a pair, having a block @<txp:c> … </txp:c> isn’t so bad.
For a single line, it’s more tricky. Is ///
used in any language?
Offline
Re: TagCommenting
Jeremie wrote:
Is
///
used in any language?
Keep in mind that the proposed comment syntax has to get out of the way of regular HTML markup and plain text.
Offline
Re: TagCommenting
How about <txp:co>Comment</txp:co>
. <txp:c>
would be ideal, but that’s reserved by the category shorthand. In any case, I think the commenting must start with <txp:
, so it won’t interfere with HTML and plain text.
Offline
Re: TagCommenting
I’d go for <txp:hide> … </txp:hide>, because that does exactly what it says and is easy to understand. With anything that doesn’t look like a txp tag, it would require the parser to do more work (slower) and leads to extra escaping requirements, because otherwise you can’t use things like /* … */ and /// in normal text.
Offline
Re: TagCommenting
If it’s not used in a language (C, Java, Ruby, whatever) I wonder where ///
could be used…
For the pair on, txp:co
, txp:h
, txp:hide
, txp:comment
it’s all the same. The best one would be the shorter one and easiest/fastest one to write and read (as in ignore by human eyes), imo. Even if it’s something like txp:h
that doesn’t make sense at first glance, source commenting is not used by beginners anyhow and it’s yet pretty understandable.
Offline
#11 2007-06-13 06:01:24
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: TagCommenting
A tag is far, far simpler to implement and less likely to break something (not to mention make better sense, logically).
<txp:hide>
would get my vote.
Even if it’s something… that doesn’t make sense at first glance…
Not a good precedent to set, though. Besides, I hardly think an extra couple letters would break anyone. I use anc_hide myself and find it simple enough.
Offline
Re: TagCommenting
Mary wrote:
Not a good precedent to set, though.
That’s already the case everytime for every tags for a good portion of the user base. Everyone without English as they first language, or even no English skill at all, don’t understand what the tag syntax means.
And, for example, txp:h
has the same amount of meaning as // or /* in every other language out there.
Last edited by Jeremie (2007-06-13 06:11:49)
Offline