[pmwiki-users] Unexpected results when "first title wins"

Petko Yotov 5ko at 5ko.fr
Sun Jun 6 10:39:54 CDT 2010

On Wednesday 02 June 2010 23:21:33, Randy Brown wrote :
> I've gotten unexpected results when I use the "First title wins" option
>  that was first offered by PmWiki version 2.2.9.
> Imagine this title on a page named X-Talk: (:title Talk about {{(substr
>  {$Name} 0 -5)}$Title} :)
> In the default PmWiki setup, the title is (as I would expect) "Talk about
>  X". But if I set the variable $EnablePageTitlePriority  to 1 in my
>  configuration file, the markup expression appears not to be executed.

Hello. Thanks for your report. This seems to happen because the result of the 
markup expression does not get the chance to be re-evaluated as a page 
variable (the default setup evaluates the title after includes, and includes 
restart the processing).

A quick fix would be to use a page variable {$BaseName} instead of a markup 
expression in your page:


where the PageVariable $BaseName is defined with such a line in config.php:
  $BaseNamePatterns['/-Talk$/i'] = '';

Alternatively, your markup expression seems fixable with such a snippet to 
config.php :

  Markup('{(', '>{$var}', '/\\{(\\(\\w+\\b.*?\\))\\}/e',
    "PRR(MarkupExpression(\$pagename, PSS('$1')))");

We might apply this change to the core, but I'm still considering if there 
aren't any undesirable side effects. There might be, in pagelists, templates, 
conditionals, possibly elsewhere.

> A second issue is that pages that I include via the SideBar sometimes have
>  their title win instead of the title on the page. 

This looks like a bug, and happens with both title setups -- probably related 
to the way PmWiki processes skin templates. If you want, you can add a PITS 
entry for this.

>  I would expect that ANY
>  included title would lose if $EnablePageTitlePriority is set to 1, not
>  just the titles included by the page itself.

No, if a page has no (:title:) directive, an included page could set a title. 
For example, a GroupHeader could automatically set the title of talk pages:
  (:if name *-Talk:)(:title Discussion about {*$BaseName}:)(:ifend:)

Only if a page has a title directive, with $EnablePageTitlePriority=1; any 
included title will lose:

However, this should apply only to (:include:)-d pages and 
GroupHeaders/Footers, it shouldn't apply to SideBars and other pages called by 
the skin template. That's why you may have found a bug.


More information about the pmwiki-users mailing list