Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
New parser testers needed
A new parser has landed in txp master branch. It means speed, short tags and much more to come. Please download and test it, to see if anything is broken (notably plugins), since the processing logic has changed quite a bit. No news would be good news. :)
Offline
Re: New parser testers needed
Not sure if it was ready to land yet. Those who use XML in their pages, should test this especially.
Offline
Re: New parser testers needed
Do you mean the new short tags regex? That’s what I hope to see. We can quickly revert it to the txp-only version if necessary, it runs for months on my site without any problem.
Offline
Re: New parser testers needed
Yes, that’s what I meant.
Offline
Re: New parser testers needed
Can you provide us with some pointers on the short tags?
test it, to see if anything is broken (notably plugins)
One casualty seems to be smd_wrap. I can successfully replace one instance of parse(EvalElse(…))
with parse_else(…)
but there is a second instance of EvalElse
on its own in the plugin code. How would one go about replacing that with the new function?
TXP Builders – finely-crafted code, design and txp
Offline
Re: New parser testers needed
Finally got around loading a site with Txp4.6dev-latest patches. The following hits all pages: Front, article listings, individual articles, …
<txp:if_description> -> Textpattern Notice: Function EvalElse is deprecated: use parse_else (and remove the separate parse() call) instead
textpattern/lib/txplib_misc.php:4229 trigger_error()
textpattern/publish/taghandlers.php:3916 EvalElse()
if_description()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:542 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:491 processTags()
textpattern/publish/taghandlers.php:2813 parse_else()
if_author()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:542 Textpattern\Tag\Registry->process()
I use this in a misc. form that goes in the head of the page
<txp:if_search><!-- nothing --><txp:else />
<txp:if_author><meta name="description" content="foo <txp:author />"><txp:else />
<txp:if_description>
<txp:meta_description /><txp:else />
<!-- missing description -->
<meta name="description" content="bar">
</txp:if_description></txp:if_author></txp:if_search>
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: New parser testers needed
Thanks for testing and report. There was one deprecated EvalElse()
call left in core, now patched. We should probably remove this annoying notice targeting plugin authors, it’s clearly disturbing.
Re short tags, <smd::wrap />
is a short-cut for <txp:smd_wrap />
, but I wouldn’t use them yet, before they get official introduction.
Offline
Re: New parser testers needed
etc wrote #298478:
Thanks for testing and report. There was one deprecated
EvalElse()
call left in core, now patched.
Thanks for the quick fix. I’ll test further later today, and see if I can find something else to keep you busy :-).
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: New parser testers needed
Hi,
No bug for me now; just want to say that this morning update really boosted my local 4.6… Thank you for your work! (Previous update was about a week ago)
Last edited by NicolasGraph (2016-05-26 12:56:02)
Offline
Re: New parser testers needed
jakob wrote #298471:
One casualty seems to be smd_wrap. I can successfully replace one instance of
parse(EvalElse(…))
withparse_else(…)
but there is a second instance ofEvalElse
on its own in the plugin code. How would one go about replacing that with the new function?
I have updated a branch with some parser tweaks, with this “deprecated” notice removed. Now EvalElse($thing, $condition)
should make no noise, but rather replace parse(EvalElse($thing, $condition))
with parse($thing, $condition)
in this branch (of which parse_else($thing, $condition)
is just an alias).
Offline
Re: New parser testers needed
Are there more plugins that use EvalElse on its own, without calling parse… and can they be made to work with the new parser?
The deprecated notice should not be removed. The use of EvalElse is deprecated, so it should make noise, so plugin developers can fix their code and EvalElse can be dropped in a future version.
Interesting parser tweaks! Do they improve performance?
Offline
Re: New parser testers needed
ruud wrote #298488:
Are there more plugins that use EvalElse on its own, without calling parse… and can they be made to work with the new parser?
Yes, at least smd_query
and etc_query
separate true/false parts to do some substitutions before calling the parser. Replacing EvalElse()
with parse_else
would break some of their functionality. I don’t see how to easily patch it atm.
The deprecated notice should not be removed. The use of EvalElse is deprecated, so it should make noise, so plugin developers can fix their code and EvalElse can be dropped in a future version.
I’m not sure EvalElse
is deprecated per se, see the first point. :) parse(EvalElse())
is, of course, but even there replacing EvalElse
with parse_else
(or parse
now) would result in parsing twice.
Interesting parser tweaks! Do they improve performance?
Thanks. No, no noticeable runtime difference (though I haven’t tested on a page with million tags), but I prefer to merge similar functions — less code to maintain. It would also be nice to totally separate parsing from processing one day. And my feeling is we should protect txp_parsed/else
inside some class, if it does not penalize performance too much.
Offline