Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-19 17:48:16

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

New and improved tag parser in TXP 4.0.7 (?)

A completely rewritten parser just landed in the 4.0 development tree

  • Full tag nesting support (unlike the current 4.0.6 parser), so this works:
<txp:if_section="something">
  do this
<txp:else />
  <txp:if_section="different">
     do that
  <txp:else />
     and otherwise do this
  </txp:if_section>
</txp:if_section>
  • Attribute value escaping: only the delimiter characters (single or double quotes) must be escaped. All other characters need no escaping inside attribute values. Examples:
<txp:tag attribute="'single' ""double"" quoted" />
<txp:tag attribute='''single'' "double" quoted' />
<txp:tag attribute="< > ' &" />
  • Unquoted attributes are deprecated and will give a warning in testing/debug mode:
Wrong: <txp:tag attribute=value />
  • Attribute parsing for attribute values enclosed in single quotes (better know as ‘wondertag’ support). Provided you use the proper quote escaping, this works till unlimited depth.
<txp:tag not_parsed="value" parsed='<txp:sometag attr="value" />' />

The new core parsing function (parse) is 50-100% slower than the old parser, but since 4.0.6, several other parsing related functions have been optimized for speed. I did a few tests with a fresh TXP install. Compared to 4.0.6, runtime (minus query time) was actually 5% faster! The actual speed difference will probably vary depending on how complex (tag nesting level) your templates are, but I don’t expect dramatic speed differences with 4.0.6.

Since this is a rather big change for what we’d like to think of as a stable TXP version, it could really benefit from some testing.

Last edited by ruud (2008-04-19 18:17:07)

Offline

#2 2008-04-19 18:23:24

kevinpotts
Member
From: Ghost Coast
Registered: 2004-12-07
Posts: 370

Re: New and improved tag parser in TXP 4.0.7 (?)

My brain just peed itself. So sweet. Thank you.

So, anyway.

When can we expect 4.0.7? :)


Kevin
(graphicpush)

Offline

#3 2008-04-19 18:28:26

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

Re: New and improved tag parser in TXP 4.0.7 (?)

Damn, revision 2860 looks nice, also nice to see little bigger changes for a while :) Must test it out on testserver.

Offline

#4 2008-04-19 18:29:24

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: New and improved tag parser in TXP 4.0.7 (?)

Ruud,

This is great, when I have a chance I’ll test nesting on a local site and let you know.

Updated a live site, set it to testing and got the warning errors for unquoted attributes, fixed a form all is well.

Should of timed the site before I updated but I notice no slowdown and all is working fine.

Thanks.

Offline

#5 2008-04-19 18:52:50

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: New and improved tag parser in TXP 4.0.7 (?)

Awesome.

Chuck it in 4.0.7

Offline

#6 2008-04-19 20:49:59

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: New and improved tag parser in TXP 4.0.7 (?)

Speechless…

(I sometimes wish – not often, but I do now – we had smilies on this forum, and not those simple subtle ones but the big and ugly ones, you know, like this: )

I’ll try and test it as soon as possible!

Offline

#7 2008-04-19 21:09:17

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

Re: New and improved tag parser in TXP 4.0.7 (?)

Oh my!!! :)

I have it installed and there are no errors and all seems to be working fine. Haven’t tried any “nesting” or “tags-within-tags” yet as, oddly, I don’t seem to be doing anything that needs it. Yet. I shall do some testing.

Last edited by thebombsite (2008-04-19 21:50:42)


Stuart

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

Offline

#8 2008-04-19 21:17:36

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: New and improved tag parser in TXP 4.0.7 (?)

oh! that’s some great news!

Offline

#9 2008-04-19 21:21:18

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: New and improved tag parser in TXP 4.0.7 (?)

Next improvement must be caching :)


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#10 2008-04-20 07:06:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: New and improved tag parser in TXP 4.0.7 (?)

this is a much anticipated improvement. Thanks ruud.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#11 2008-04-20 08:43:36

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: New and improved tag parser in TXP 4.0.7 (?)

Ruud, that’s sounds very, very good! :-)


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#12 2008-04-20 11:16:45

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: New and improved tag parser in TXP 4.0.7 (?)

WoOoOW! That’s a really huge improvement. Thanks ruud!
BTW I tested it in an existing site replacing all instances of wondertag and it works ok for me.

Last edited by redbot (2008-04-20 17:46:34)

Offline

Board footer

Powered by FluxBB