Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-06 09:30:03

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

<txp:tag><txp:tag></txp:tag></txp:tag>

Does that have a name in computer language? Ayway, while developing a plugin, i noticed a problem. For the sake of simplicity, let’s image a new container tag called <txp:loop>, and the following test scenario :

<txp:loop times="3">loop:<txp:loop times="5">a</txp:loop>, </txp:loop>

this should render loop:aaaaa, loop:aaaaa, loop:aaaaa, loop:aaaaa, loop:aaaaa, but renders loop:<txp:loop times="5">aloop:<txp:loop times="5">aloop:<txp:loop times="5">a, </txp:loop> instead. The first </txp:loop> is read as being the closing tag for the outer <txp:loop> instead of the inner tag.

This could be fixed by improving the regex in the parse() function in publish.php. I think.

Last edited by guiguibonbon (2007-08-06 09:30:33)

Offline

#2 2007-08-06 09:39:10

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

Re: <txp:tag><txp:tag></txp:tag></txp:tag>

That will not be fixed in 4.0.x, but it’ll work in 4.1 which has a completely new parser.

Offline

#3 2007-08-06 09:52:20

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: <txp:tag><txp:tag></txp:tag></txp:tag>

… (disappointed gasp for having heard that answer a few too many times)

(tries what feels like a useless attempt) Since this is technically speaking a bug, wouldn’t it be justified to already replace the parse function? It looks pretty solid to me.

Offline

#4 2007-08-06 10:24:33

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

Re: <txp:tag><txp:tag></txp:tag></txp:tag>

Take the 4.1 parser and put that in 4.0, you mean?… nope. Although it’ll probably recognize nested tags perfectly and just work fine in general, it would not surprise me if the 4.1 parser (as it is now) is quite a bit slower than the one in 4.0. That and the fact that it hasn’t received a lot of testing (as far as I know) is a good reason not to introduce it into 4.0.x.

I’ve had the same problem with one of my own private plugins btw. I solved it by creating a few tag aliases and using those to make nesting possible:

function loop1($atts, $thing) { return loop($atts, $thing); }
function loop2($atts, $thing) { return loop($atts, $thing); }

Not a very clean solution, but works fine.

Offline

#5 2007-08-06 11:14:26

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: <txp:tag><txp:tag></txp:tag></txp:tag>

Thanks for the suggestion. I actually ended up using a form attribute and closed tags. Yours is probably much faster.

Totally unrelated, but your answer raises some questions. I bet there will be quite a lot of other functions in 4.1 that might be slower and /or haven’t been tested a lot. Which gets me wondering what kind of mess the beta-testing of 4.1 will be. I’m certain you all have thought this through a lot; but this sounds to me like the perfect example where incrementally upgrading certain things would be safer. Same goes with image thumbnailing, to name just another obvious case.

Offline

#6 2007-08-06 12:18:23

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

Re: <txp:tag><txp:tag></txp:tag></txp:tag>

People expect some problems when beta testing a completely new version like 4.1 (longer period of beta versions and release candidates to iron out the bugs), but in a stable series like 4.0.x, it should just work without risking regressions.

Offline

#7 2007-08-06 19:28:15

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: <txp:tag><txp:tag></txp:tag></txp:tag>

Whilst on the subject of 4.1 and testing, when would you expect that to start? Do you need testers? If you do I’m all ears.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB