Textpattern 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: 4,480
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: Kansas City
Registered: 2004-12-07
Posts: 364
Website

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? :)

Offline

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

Gocom
Developer
Registered: 2006-07-14
Posts: 4,403
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.


Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

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

hcgtv
Member
From: Charlotte, NC
Registered: 2005-11-29
Posts: 2,154
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.


txp:tag – Textpattern Tags ~ TxPlanet – Textpattern Planet

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
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,374
Website

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!


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

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

thebombsite
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 – The BombsiteProText ThemesTextgarden

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: 4,821
Website

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

this is a much anticipated improvement. Thanks ruud.


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

Board footer

Powered by FluxBB