Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-02-06 06:37:16

akurei77
New Member
Registered: 2011-02-04
Posts: 4

[textile] Allow "html" brackets (less than, greater than) in articles?

I can’t seem to find an answer to this problem anywhere. According to the FAQ, it looks like I shouldn’t even be having this issue, so I’m hoping someone here can help me out.

One section of the website I’m building will be dedicated to IRC quotes. Unfortunately, when I paste in test quotes, any nickname between brackets gets stripped so that

<akurei77> Hi, how are you
<someone> Doing well thank you

shows up only as

Hi, how are you
Doing well thank you

This kind of defeats half the purpose of having an archive. Does anyone know how I can make it allow brackets like that? Like I said, they’ll be posted as their own section, so if there is a way to disable textile for a single section, either through preferences or code, that would probably work.

Thanks.

Offline

#2 2011-02-06 08:26:54

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

Well Textile 2.2 test page tells me that you are right :(
Note: Didn’t test it on live TXP site.

The < behaviour is kinky too.

sdf sshsa > iosgu djfg iodjid j
sdf sshsa < iosgu djfg iodjid j
sdf sshsa < iosgu > djfg iodjid j
sdf sshsa <iosgu> djfg iodjid j

Some kind soul should push this thread into the textile forum for bug verification & fix.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#3 2011-02-06 12:04:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,394
Website GitHub

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

merz1 wrote:

Some kind soul should push this thread into the textile forum for bug verification & fix.

fwiw I’m not convinced it’s a Textile issue. If you look closely at the Underlying HTML you’ll see that it passes the bracketed names through unscathed. You can prove this by turning Textile off — you still don’t see the bracketed names.

Nor do I think its a TXP issue (although it could be the parser I suppose: more testing required). My guess is it’s the browser that’s treating the ‘tags’ as invalid HTML (or XML?) markup and ignoring them. Again, if you look at the source code you’ll see that the bracketed elements are on the page, they just don’t show up on the site.

One way round it might be to use a plugin like pax_grep or Gocom’s replace plugin to swap any occurrence of < with < (bracket-space) in the <txp:body /> tag. For neatness you could also do the same with >, using space-bracket to even things up a bit.

EDIT: or alternatively, swap the brackets out for their HTML entitity names on the fly? Might work.

Last edited by Bloke (2011-02-06 12:06:50)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2011-02-06 12:41:42

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

Bloke wrote:

One way round it might be to use a plugin like pax_grep or Gocom’s replace plugin to swap any occurrence of < with < (bracket-space) in the <txp:body /> tag. For neatness you could also do the same with >, using space-bracket to even things up a bit.

That would break all real HTML tags too, wouldn’t it? Anyways, yes it would be doable:

For example to replace brackets with entities:

<txp:rah_replace from="<,>" to="&#60;,&#62;">
	<txp:body />
</txp:rah_replace>

Or to bracket space:

<txp:rah_replace from="<,>" to="< , >">
	<txp:body />
</txp:rah_replace>

Offline

#5 2011-02-06 12:43:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,394
Website GitHub

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

Gocom wrote:

That would break all real HTML tags too, wouldn’t it?

Ah, duh, yeah.

/me climbs back in his box


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2011-02-06 12:54:41

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

Bloke wrote:

/me climbs back in his box

I’m sure I heard something, but here isn’t anything than this moving box.

Offline

#7 2011-02-06 13:20:25

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

Hmm (just reporting), posting my example code block from above:

sdf sshsa > iosgu djfg iodjid j
sdf sshsa < iosgu djfg iodjid j
sdf sshsa < iosgu > djfg iodjid j
sdf sshsa <iosgu> djfg iodjid j

… into the Textile 2.2 form changes the input form (after click) to (check the <):
Browser used: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.9.2.14) Gecko/20110121 Firefox/3.6.14

sdf sshsa > iosgu djfg iodjid j
sdf sshsa <iosgu djfg iodjid j
sdf sshsa <iosgu > djfg iodjid j
sdf sshsa <iosgu> djfg iodjid j

Browser output:

sdf sshsa > iosgu djfg iodjid j
sdf sshsa
sdf sshsa djfg iodjid j
sdf sshsa djfg iodjid j

Edit/Add: The ‘browser output’ div:

<div class="output">	<p>sdf sshsa &gt; iosgu djfg iodjid j<br>
sdf sshsa <iosgu j="" iodjid="" djfg=""><br>
sdf sshsa <iosgu> djfg iodjid j<br>
sdf sshsa <iosgu> djfg iodjid j</iosgu></iosgu></iosgu></p></div>

Underlying HTML (check the < and >):

  <p>sdf sshsa &gt; iosgu djfg iodjid j<br />
sdf sshsa <iosgu djfg iodjid j<br />
sdf sshsa <iosgu > djfg iodjid j<br />
sdf sshsa <iosgu> djfg iodjid j</p>

Last edited by merz1 (2011-02-06 13:24:35)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#8 2011-02-06 13:30:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,394
Website GitHub

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

merz1

Sorry Markus, I quoted you after your code example but I was actually referring to the problem in the OP. My apologies.

Not sure why the input form changes on submit. Mad, and well spotted!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#9 2011-02-06 13:42:03

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

merz1 wrote:

Some kind soul should push this thread into the textile forum for bug verification & fix.

I’ll do so; note that you can report issues directly from the Textile test page.


Code is topiary

Offline

#10 2011-02-06 18:50:14

akurei77
New Member
Registered: 2011-02-04
Posts: 4

Re: [textile] Allow "html" brackets (less than, greater than) in articles?

Bloke wrote:

fwiw I’m not convinced it’s a Textile issue[…] My guess is it’s the browser that’s treating the ‘tags’ as invalid HTML (or XML?) markup and ignoring them. Again, if you look at the source code you’ll see that the bracketed elements are on the page, they just don’t show up on the site.

You’re right; Opera’s Dragonfly shows that it is interpreting the names as attempts at html, so it is just not displaying them.

One way round it might be to use a plugin like pax_grep or Gocom’s replace plugin to swap any occurrence of < with < (bracket-space) in the <txp:body /> tag. For neatness you could also do the same with >, using space-bracket to even things up a bit.
EDIT: or alternatively, swap the brackets out for their HTML entitity names on the fly? Might work.

Unfortunately, as Gocom mentioned, that does break all other HTML tags as well. I thought I might be able to get around it by replacing the brackets back for certain basic HTML tags, but then I realized I couldn’t manage to do that for links.

It seems like the best solution would be to replace the brackets with the correct entities before the textile markup is replaced with HTML. Sadly I don’t remember my PHP nearly well enough any more to pull off something like that myself at this point. On second thought, I decided to poke around the textile source and saw a note to “escape any raw html” using the textileRestricted call, so I thought I’d try changing all textileThis() calls to textileRestricted() in tpx_article.php, and that has solved my problem.

I don’t know if that’s a good idea for a permanent fix since I have no idea what else Restricted will affect, but I can revert if anyone has a better suggestion.

Thanks everyone.

Offline

Board footer

Powered by FluxBB