Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-10-08 11:36:06

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

Re: [issue] Special HTML characters (<, >, &) in article titles

That won’t help with existing page titles.

Obviously true. Shouldn’t be an obstacle to introduce this from now on. I strongly believe that Textile (or any other markup generator) is generally preferrable over HTML markup, as far as content authors are concerned.

Offline

#14 2005-10-27 20:20:30

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

Re: [issue] Special HTML characters (<, >, &) in article titles

I want to share a little trick that can be useful for including HTML tags in article titles.
<a href=“http://forum.textpattern.com/viewtopic.php?pid=83109#p83109”>using HTML tag in article title and stripping it in browser title tag</a>

Please, let me know if this work for you.

BTW, I want to ask something: when I include an ampersand in the article title, I do it by typing <code>&amp;amp;</code>.
Then, I save my article.
But if I’m going to edit the article again, in the article title field, the <code>&amp;amp;</code> has been removed and simple replace by &amp;.

The problem is: if I dont notice that my article title has been modified and save the article without correcting again the ampersand, then my site will ouput invalid code (unescaped ampersands).

Last edited by maniqui (2005-10-27 20:21:57)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#15 2005-11-05 14:03:25

loid
Member
Registered: 2005-03-09
Posts: 38

Re: [issue] Special HTML characters (<, >, &) in article titles

Up until 4.01, or possibly even 4.02, I used page break and italic/emphasis mark-up in article titles without problem. Now that shows up in the headlines (article titles) instead of creating a page break or italic text.

Last edited by loid (2005-11-05 14:04:22)

Offline

#16 2005-11-05 14:19:53

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: [issue] Special HTML characters (<, >, &) in article titles

loid – It’s a matter of entity encoding, and has been discussed here and elsewhere.


And then my dog ate my badger, and the love was lost.

Offline

#17 2005-11-05 15:16:19

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

Re: [issue] Special HTML characters (<, >, &) in article titles

In this issue, 4.0.2 breaks backward compatibility.

I’m thinking loud:
For future releases

  • if someone wants to use special characters (like <, >, &) in article titles, he/she should type it directly as an html entity (<code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;amp;</code>), and dont expect that TXP does the conversion if they are typed as <, > or &.
  • allow the use of HTML elements in article titles (and in section/category titles). This adds more flexibility to TXP, and also doesnt break backward compatibility.

Finally, I quote myself: <blockquote>when I include an ampersand in the article title, I do it by typing <code>&amp;amp;</code>.
Then, I save my article.
But if I’m going to edit the article again, in the article title input field, the <code>&amp;amp;</code> has been removed and simple replace by &.</blockquote>

If I input a <code>&amp;amp;</code>, then, when re-editing the article, I get a & (not encoded, as I typed it before). My question: is this a “fault” of TXP, or the database or the browser?
I mean, who is the responsible of changing what I typed originally (<code>&amp;amp;</code>) to another thing (&)?

Thanks.

Last edited by maniqui (2005-11-05 15:18:00)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#18 2005-11-05 21:47:51

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Special HTML characters (<, >, &) in article titles

if someone wants to use special characters (like <, >, &) in article titles, he/she should type it directly as an html entity (&lt;, &gt;, &amp;), and dont expect that TXP does the conversion if they are typed as <, > or &.

That’s the opposite of most user’s expectations. It’s different to the behaviour of other fields like excerpt and body. It means that we rely on the user for RSS and Atom validity. And there are many named entities that are valid XHTML but invalid in an XML feed.


Alex

Offline

#19 2005-11-06 12:23:11

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

Re: [issue] Special HTML characters (<, >, &) in article titles

maniqui wrote:
if someone wants to use special characters (like <, >, &) in article titles, he/she should type it directly as an html entity (<code>&amp;lt;</code>, <code>&amp;gt;</code>, <code>&amp;amp;</code>), and dont expect that TXP does the conversion if they are typed as <, > or &.

As Zem said, we want the opposite. The simplest way. That’s if we want a >, we type a >. If that’s is not valid for some technico-geeky-mysterious reason, let the software encode it properly (should I remember that most user don’t know what is a XML boundary character, and more don’t care ?).

allow the use of HTML elements in article titles (and in section/category titles). This adds more flexibility to TXP, and also doesnt break backward compatibility.

If that doesn’t break anything, yep why not. I more enclined to allow Textile in title (I personnaly heavily use book title in article title, and miss the appropriate tag —??cite??).

Offline

#20 2005-11-08 03:59:25

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

Re: [issue] Special HTML characters (<, >, &) in article titles

> Etz Haim wrote:

<blockquote>For example, and article is titled “a > b is a conditional”, and <txp:page_title separator=" :: " /> outputs:

<title> My Site Name :: a > b is a conditional </title>

which is invalid XHTML.
</blockquote>

I have tested (using a 4.0.1, but sure it’s also the same in 4.0.2) that the above is valid XHTML. I didnt receive any error when using > or < in titles. I also included an &, but it was correctly escaped to an html numeric entity.
When I run the page through the validator.w3.org, it says: “This Page Is Valid XHTML 1.0 Strict!

OK, I must admit I receive some warnings, but it doesnt means “invalid”, or it does?

Quoted from the Mark-up Validation Service:

<blockquote> Warning Line 14 column 43: character “<” is the first character of a delimiter but occurred as data.

< title>A > B & C < D | < /title>

This message may appear in several cases:

  • You tried to include the “<” character in your page: you should escape it as “&lt;”
  • You used an unescaped ampersand “&”: this may be valid in some contexts, but it is recommended to use “&amp;”, which is always safe.
  • Another possibility is that you forgot to close quotes in a previous tag.</blockquote>

The HTML Tidy for Firefox shows those nice green icons that read “0 errors / 0 warnings”

But it’s very possible that I’m wrong and that “warning” message in the validation service deserves more attention and respect.
Or maybe not, and it just means nothing dangerous, and we can keep using > and < in our page titles without the need of escaping them to html entities.

So, in the meanwhile, maybe HTML elements in article/section/category titles can be restored, and also, < and > can be used without escaping them.

If behaviour is reverted

  • if someone wants to use < and >, he can use them and still have valid code.
  • if someone wants to include HTML elements in article/section/category titles, he can also use them (but remember to follow the tip above to remove it from the < title> tag by using the sab_striphtml plugin).

Am I missing something? (I have no doubt I am missing something)

Last edited by maniqui (2005-11-08 12:18:07)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#21 2005-11-08 09:04:05

Etz Haim
Archived Plugin Author
From: Karlstad, Sweden
Registered: 2005-01-24
Posts: 262
Website

Re: [issue] Special HTML characters (<, >, &) in article titles

Yes, it is invalid. Just think what a combination of < and > could do, ie. in a more complex formula.

Last edited by Etz Haim (2005-11-08 09:05:21)

Offline

#22 2005-11-13 18:30:37

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

Re: [issue] Special HTML characters (<, >, &) in article titles

Etz Haim wrote:

<blockquote>Yes, it is invalid. Just think what a combination of < and > could do, ie. in a more complex formula.</blockquote>

when you say “a more complex formula”, are you talking about math formulae and logical formulae as the “a > b” you put as example in the first post?

My argument

if you need to write more complex formulae, surely you will need more symbols than simple <, > and =.
For sure, you will want to use formulae symbols like:

<big>*&supe; &ge; &equiv; &ne; &phi; &infin; &fnof; &harr;*</big> and many other symbols.

Do you have those symbols in your keyboard? I suppose you dont, so, how will you put them in your article title?
You will do the same I did to display those symbols in this post:
you will type them as HTML entities:

<code>&amp;supe; &amp;ge; &amp;equiv; &amp;ne; &amp;phi; &amp;infin; &amp;fnof; &amp;harr;</code>

So, this is my logic: if you need to type those symbols as HTML entities, why wont you type the < and > also as HTML entities? wont you type them as entities because you have them in your keyboard?. Lazy boy! ;)

Well, as a second argument, I would ask: arent math/logical formulae out of the scope of a simple article title? I want to mean: arent formulae a very rare case in article titles? wont be the need of formulae in titles just to a very small niche of txp users?
Is it very common to have “a > b”-like titles in your posts? I dont know, I’m just asking.

One counterargument to my argument

Sure, many users will use > and < in a context that is not a math formulae.
Article titles like “It’s my birthday > buy me a present!” ¿are of common use? (I dont know).
If user wants to type > and < directly from the keyboard, they should accept they will have invalid code in their <code><title></code> and also in his site.

Finally, I ask, have we lost the power of using HTML elements in our article/section/category titles just for escaping <, > and &?

I’m asking standing at my own ignorance, because I dont know how dangerous could be to have a few unescaped characters in our code.
And there is no need to expect that TXP do the job of escaping those characters: just learn to type <code>&amp;lt;</code>, <code>&amp;gt;</code> and that’s all you need to know.

Thanks <small>and excuse my barbarian english and some lack of consistency behind my logic</small>


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#23 2005-11-13 23:21:50

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

Re: [issue] Special HTML characters (<, >, &) in article titles

That’s why unicode is for. Title are supposed to handle complex glyph.

How to type them ? Well the same way you type them everywhere… if one needs help, upm_quicktags does this wonderfully.

Offline

#24 2005-11-13 23:31:07

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [issue] Special HTML characters (<, >, &) in article titles

maniqui: it’s still not clear to me what you’re proposing. Send us some code that does what you’re suggesting and we’ll take a look at it.

Otherwise, I think this has strayed a long way from being a bug report.


Alex

Offline

Board footer

Powered by FluxBB