[pmwiki-users] $BaseName (was Re: pmwiki-2.2.0-beta9 release (bugfix, pagevar filters in pagelists))

Crisses crisses at kinhost.org
Tue Oct 3 07:42:35 CDT 2006


On Oct 3, 2006, at 8:31 AM, Kathryn Andersen wrote:

> On Mon, Oct 02, 2006 at 12:43:04PM -0500, Patrick R. Michaud wrote:
>> On Mon, Oct 02, 2006 at 11:32:27AM -0400, Crisses wrote:
>> This is now possible in 2.2.0-beta10 (just released), using
>> the new {$BaseName} page variable markup.
>
> I'm a bit confused about what the $BaseName actually gives you,  
> what it
> actually applies to.

It's to help out when we have two groups with associated pages.

Example:

Main.HealthCare
with its associated comment page:
Main-Comments.HealthCare

If you used an (:include Main-Comments.{*$Name}:) in the GroupFooter,  
for example, the text of the Comments page is IN the Main.HealthCare  
page.  But pagelists and search results will come up with the Main- 
Comments page naturally.  So you have to explicitly tell PmWiki "When  
a page contains '-Comments' strip that out for the base page to return".

This opens up a can of worms when writing pagelist recipes/formats.

>> Essentially, an administrator or recipe uses $BaseNamePatterns
>> to define transformations from a pagename into its "base" form.
>> For example, a comments recipe might define:
>>
>>     $BaseNamePatterns['/-Talk$/'] = '';
>
> Are the BaseNamePatterns applied to the $FullName of the page?
> Or the $Name of the page?

full name - -group included.

>> and then in the pagelist template to refer to the non-Data
>> group regardless of source one would use things like:
>>
>>     {=$BaseName}           "Simile.XYZ"
>>     {{=$BaseName}$Group}   "Simile"
>>
> I don't understand the nested { } markup -- what does that do?

It will interpret the page's basename first -- in this case the found  
page in the search/pagelist is:
Data-Simile.XYZ
the basename is Simile.XYZ
the variable reference {{=$BaseName}$Group} becomes {Simile.XYZ 
$Group} -- in other words "Return the $Group variable from the base  
page".
which is "Simile"

>> Or, to always get the Data- group regardless of source, one would  
>> use:
>>
>>     Data-{=$BaseName}           "Data-Simile.XYZ"
>>     Data-{{=$BaseName}$Group}   "Data-Simile"
>>
>
> What if I had a page, say, "Stories-Highlander.DeadlySecrets"
> Does this mean that if I had
>
>      $BaseNamePatterns['/^Stories-/'] = '';
>
> Then the $BaseName of that page would be "Highlander.DeadlySecrets"?
Yes

> What if I wanted just the "base group"?  (In this case, "Highlander")
> Would I be able to get that?

{{=$BaseName}$Group}

Crisses




More information about the pmwiki-users mailing list