[pmwiki-devel] Formatting page names

Simon nzskiwi at gmail.com
Mon Apr 1 16:00:23 PDT 2024


thanks very much, that's brilliant
Simon

On Tue, 2 Apr 2024, 09:59 Petko Yotov, <5ko at 5ko.fr> wrote:

> $MakePageNamePatterns has rules calculating the page name Group.PageName
> from a string like "page name". It seems you need a way to "space" page
> names like in {PageName$Namespaced} or in {(asspaced text)}, that's the
> opposite.
>
> Spacing is done by the function AsSpacedUTF8($text) which converts a
> string with WikiWords into a spaced version of that string. It can be
> overridden via $AsSpacedFunction:
>
>    $AsSpacedFunction = 'SimonAsSpaced';
>    function SimonAsSpaced($text) {
>      $text = AsSpacedUTF8($text);
>      $text = preg_replace('/([A-Z])\\s+(\\d)/', '$1$2', $text);
>      return $text;
>    }
>
> Here, instead of rewriting the whole AsSpacedUTF8() function, we call
> it, then undo the damage it did to our text.
>
> With this, "{E1Freeway$Namespaced}" will print "E1 Freeway".
>
> Alternatively, you can copy the full AsSpacedUTF8() function to
> config.php under a different name, adapt it, and set the
> $AsSpacedFunction variable to the new name.
>
> Petko
>
> On 01/04/2024 22:23, Simon wrote:
> > I've had a look through the documentation and discovered
> > $MakePageNamePatterns,
> >
> > What I want to do is exclude certain patterns from being space
> > separated.
> >
> > Specifically a Capital letter followed by a digit.
> >
> > e.g. " E1 " is displayed as " E 1 "
> >
> > Is there a way to configure this?
> >
> > thanks in advance
> >
> > Simon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20240402/7ebd9dde/attachment.html>


More information about the pmwiki-devel mailing list