[pmwiki-users] automatic page titles (aless) - working! (aless)

John Rankin john.rankin at affinity.co.nz
Mon Aug 4 19:54:23 CDT 2008


>   1. Re: automatic page titles (aless) (aless)
>   2. Re: automatic page titles (aless) - working! (aless)
>   3. Re: automatic page titles (aless) (John Rankin)
>
>From: aless <alessors at gmail.com>
>Subject: Re: [pmwiki-users] automatic page titles (aless)
>
>Hello John,
>
[...]
>
>For the moment I settled with the spaces and apostrophes to underscores, 
>which breaks the original links of a fresh installation of PmWiki, but 
>works fine with newly created pages. I put everything in
>local/config.php:

See discussion below of why links to existing pages break.
>
[...]
>Subject: Re: [pmwiki-users] automatic page titles (aless) - working!
>
>Sorry, it seems my installation wasn't as fresh as I thought. Tried 
>again in a newly extracted PmWiki folder and everything is
>working fine.

Excellent!
>
>Should we add this modified version to the 
>Cookbook.AlternateNamingScheme page?

I suggest we sort out links to existing pages first.

The spacenames.php script on that page provides a replacement
MakePageName function that should find PageName if it exists
and Page_name does not. However, this is 3 years and many pmwiki
versions old. I'll look to see if it's possible to configure
the current version of MakePageName to ask it to look for
pages created under the default pmwiki naming scheme. If not,
you should be able to merge the code into your version of the 
recipe.

This involves teaching the $MakePageNameFunction to support 
both the original pmwiki and new local page naming schemes.
Ideally we should be able to do this through the standard
MakePageName function, but at the time I couldn't work oout
how to do this, so borrowed pmwiki's and added an extra 
processing rule.

JR -- see below for more information about the problem and
how we can solve it.
>
>  alessandro
>
>From: John Rankin <john.rankin at affinity.co.nz>
>Subject: Re: [pmwiki-users] automatic page titles (aless)
>>
>>  [...]
>>
>>By the way, as a side effect of having the new page naming scheme, the 
>>old links are obviously not recognized anymore, for example, most of the 
>>pages in the Documentation Index. Should I rename them manually or is 
>>there a quicker solution? A renaming script, maybe?
>
>(I got distracted and didn't respond to this issue)
>
>Once you have got new page names working the way you want, there is
>a solution to this that doesn't involve renaming old pages :-)
>
>The problem you face is that PmWIki has a MakePageName function
>that decides whether a page already exists or is a new page. It
>does this by turning [[link text]] markup into a valid page name
>and calling a PageExists($pagename) boolean function.
>
>What you are doing is changing the rules for how [[link text]]
>becomes a pagename. Instead of getting {$Group}.LinkText [1]
>you are getting {$Group}.Link_text. For example, a link to 
>[[PmWiki/documentation index]] tries to find a page called
>PmWIki.Documentation_index and fails.
>
>So what we have to do is instruct PmWiki to look for 
>Documentation_Index *and* DocumentationIndex. From memory the
>alternate page naming scheme recipe code does this. I know I
>solved this problem at one point, but it was quite a while ago
>now and I don't remember the code details (or if I released it 
>as a recipe).
>
>I suggest you get the alternate naming scheme working to your
>satsfaction first, then look at how to teach PmWiki how to
>continuing to recognise links to pre-existing pages. The only
>trick will be deciding which page takes precedence if there
>are 2 pages, one named LinkText and one named Link_text.
>However, since from memory you have WikiWords disabled, this
>should not be too much of a problem. The implementation 
>details will depend on precisely what capitalisation scheme 
>you implement.
>
>Hope this helps
>JR
>
>[1] to be precise, it also looks for LinkText.LinkText and 
>    LinkText.HomePage, but set these to one side for the
>    purposes of this discussion
>>


-- 
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz





More information about the pmwiki-users mailing list