01365: ftime markup expression not working properly in conditional markup when referencing PTV
Description: When I'm referencing a page text variable (PTV) from another PmWiki page in "if equal" conditional markup, ftime markup expression doesn't seem to work properly.
This is the steps I took in order to isolate the issue:
Content of PLCalDemo/20150502:
TestVar: ValueofTestVar
Path to PLCalDemo/20150502 with reference to page text variable "TestVar" (successfully generated using ftime):
PLCalDemo/{(ftime fmt='%Y0502')}$:TestVar |
PLCalDemo/20250502$:TestVar |
Current value of page text variable "TestVar" in calendar page (successfully retrieved using ftime):
{PLCalDemo/{(ftime fmt='%Y0502')}$:TestVar} |
Conditional markup evaluating "TestVar", using ftime (unsuccessful; should return "True"):
(:if equal "{PLCalDemo/{(ftime fmt='%Y0502')}$:TestVar}" "ValueofTestVar":) True (:else:) False (:ifend:) |
False |
Conditional markup evaluating "TestVar", using static URL instead of ftime (successful):
(:if equal "{PLCalDemo/20150502$:TestVar}" "ValueofTestVar":) True (:else:) False (:ifend:) |
True |
If using "if exists" instead of "if equal", everything works fine with ftime:
(:if exists PLCalDemo/{(ftime fmt='%Y0502')}:) True (:else:) False (:ifend:) |
False |
Only the section formatted in red doesn't seem to work as expected. Did I overlook something here maybe?
Thanks! StefCT May 03, 2015, at 06:37 AM
{$:PageVar}
markup is evaluated before the {(mx...)}
markup, see PITS?action=ruleset, and this allows you to use PageVariables inside Markup Expressions like {(ftime when=@{Main.HomePage$LastModifiedTime})}
or {(toupper {$:Summary})}
. You seem to request that PageVariables be processed after MarkupExpressions (this is unlikely to happen as many wikis use the current format). It is possible to request that PmWiki restarts the processing of markup rules after the MarkupExpression - I don't immediately see a problem with this but messing with markup rules in some cases leads to disasters. Anyways, if you want to enable it and test it, add this to config.php: Markup_e('{(', '>{$var}', '/\\{(\\(\\w+\\b.*?\\))\\}/', "PRR(MarkupExpression(\$pagename, \$m[1]))");
(Enabled on this page, appears to work.) --Petko May 04, 2015, at 10:18 AM
Thanks! I've enabled your code in my wiki. Seems to work as expected. I'll watch closely whether it affects other markup somehow!
StefCT May 04, 2015, at 01:12 PM