[pmwiki-users] Looking for a recipe or configuration for page templates

Petko Yotov 5ko at 5ko.fr
Sat Feb 3 23:14:16 PST 2024


Added for 2.3.31 -- I'll be using it as well.

Remember that a comma separates different pagename patterns, so 
name=a*,b would apply to pages where the name either starts with A, or 
where the name is exactly "B" (in any group).

If you allow commas in the pagenames like with the SubgroupMarkup 
recipe, you can match the comma with the "?" question mark character.

Petko

On 03/02/2024 23:36, Simon wrote:
> Petko,
> that would be brilliant, thanks very much
> 
> Simon
> 
> On Sat, 3 Feb 2024 at 21:45, Petko Yotov <5ko at 5ko.fr> wrote:
> 
>> We could add it. Would something like this this be convenient:
>> 
>> $EditTemplatesFmt[] = '{$SiteGroup}.MapsTemplate
>> name=*map,*maps';
>> 
>> This would work like the name= argument in pagelists and other
>> directives, and the template Site.MapsTemplate will only be loaded
>> on
>> pages that match the specification.
>> 
>> Petko
>> 
>> On 03/02/2024 00:07, Simon wrote:
>>> Using PmWiki | Cookbook / EditTemplates [1] it is possible to
>>> "pre-fill" a new page from a templates, e.g.
>>> 
>>> $EditTemplatesFmt [2] = '{$SiteGroup}.{$Name}Template';which looks
>> in
>>> the Site group for a template matching the name of the page being
>>> created. For example, the above would use "Site.HomePageTemplate"
>> (if
>>> it exists) anytime an author creates a page named "HomePage" (in
>> any
>>> group).
>>> 
>>> I'm looking for something that moves this up a notch by marching
>> the
>>> new page name, e.g.
>>> $EditTemplatesFmt['pattern'] = ['*some?text*',
>>> 'SomeTemplatePagename'];
>>> i.e. to be able to specify a pattern (normal or regex) that when
>>> matched against a "new" page name successfully specified the page
>> to
>>> be used as the template
>>> for example
>>> $EditTemplatesFmt['pattern'] = ['*maps', 'MapsTemplate'];
>>> 
>>> Or ideas on how to implement this?
>>> 
>>> thanks very much
>>> 
>>> Simon
>>> 
>>> Links:
>>> ------
>>> [1] https://www.pmwiki.org/wiki/Cookbook/EditTemplates
>>> [2]
>> https://www.pmwiki.org/wiki/PmWiki/EditVariables#EditTemplatesFmt
>>> _______________________________________________
>>> pmwiki-users mailing list
>>> pmwiki-users at pmichaud.com
>>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list