Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-06-12 18:29:51

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

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

#2 2007-06-12 18:57:24

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TagCommenting


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2007-06-12 19:03:40

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

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

#4 2007-06-12 20:21:18

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: TagCommenting

Please elaborate on a possible comment delimiter pair/single line comment introduction.

Offline

#5 2007-06-12 20:45:21

reid
Member
From: Atlanta, Ga.
Registered: 2004-04-04
Posts: 224
Website

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

#6 2007-06-12 20:56:09

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

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

#7 2007-06-12 20:58:38

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

#8 2007-06-12 21:07:21

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

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

#9 2007-06-12 21:11:23

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#10 2007-06-13 00:19:06

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

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

#12 2007-06-13 06:10:20

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

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

Board footer

Powered by FluxBB