Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
Offline
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.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
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
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
Re: New and improved tag parser in TXP 4.0.7 (?)
oh! that’s some great news!
Offline
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
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
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