[pmwiki-devel] Pages names such as Tūroa
John Rankin
john.rankin at affinity.co.nz
Thu Jul 25 19:50:47 PDT 2019
There is a targeted local customisation which I think will work. In
local/config.php the site could over-ride the default treatment of
[[!Category]] markup. Try the following code:
$LongVowels = array (
'A' => 'Ā',
'a' => 'ā',
'E' => 'Ē',
'e' => 'ē',
'I' => 'Ī',
'i' => 'ī',
'O' => 'Ō',
'o' => 'ō',
'U' => 'Ū',
'u' => 'ū');
function MacronHelper($match) {
global $LongVowels;
return $LongVowels[$match[1]];
}
Markup('[[!','<[[','/\\[\\[!(.*?)\\]\\]/',
function ($m) use(&$pagename) {
$text = preg_replace_callback('/\{([AEIOUaeiou])\}/',
"MacronHelper", $m[1]);
return Keep(MakeLink($pagename,
$GLOBALS['CategoryGroup'].'/'.$m[1], $text, '',
$GLOBALS['LinkCategoryFmt']), 'L')
} );
With this code, writing [[!T{u}roa]] should create a link to page
Category.Turoa with the link text Tūroa. Links to categories
without long vowels, such as [[!Akaroa]] should continue to work.
The {a} {e} {i} {o} {u} markup will only work inside category markup. A
more general solution which would work anywhere in the text would need a
further markup rule.
Hope this helps.
JR
On 23/07/19 11:33 AM, John Rankin wrote:
>
> Interesting; I did not know that.
>
> A markup rule that translates [[!Turoa|+]] into [[Category.Turoa|+]]
> might work, although category markup uses a special categorylink class
> in the <a> link generated. Or you could introduce a local category
> markup rule just for this purpose, for example so that [[!T`uroa]] is
> turned into [[Category.Turoa|T#363;roa]] (ie look for "`[aeiouAEIOU]"
> inside category link markup, then process as a category link). The
> rule would have to fully process the link markup, as it needs to use
> the category link format, with the correct class attribute.
>
> A bit more investigation is needed, I think.
>
> JR
>
> On 21/07/19 10:31 PM, Simon wrote:
>> Thanks, it actually came about because I was trying to use [[!Tūroa]]
>> for which there is no markup [[!Turoa|+]]
>> ____
>> http://kiwiwiki.nz
>>
>>
>> On Sat, 20 Jul 2019 at 14:55, John Rankin <john.rankin at affinity.co.nz
>> <mailto:john.rankin at affinity.co.nz>> wrote:
>>
>> One (least work) option would be to name the page Turoa, and add
>> (:title T#363;roa:) to the page text. You would want to use
>> [[Turoa |+]] when linking to the page.
>>
>> JR
>>
>> On 20/07/19 2:14 PM, Simon wrote:
>>> Any suggestions on how I can create page names such as T#363;roa.
>>>
>>> I have an older wiki - not UTF8.
>>>
>>> Would it work to add characters such as āēīōū to the valid page
>>> name character set
>>> (BTW please point me to the page where this is documented, I
>>> couldn't easily find it - closest I could get to was
>>> https://www.pmwiki.org/wiki/PmWiki/BasicVariables#NamePattern but
>>> has no detail)
>>>
>>> thanks
>>>
>>> Simon
>>>
>>>
>>> _______________________________________________
>>> pmwiki-devel mailing list
>>> pmwiki-devel at pmichaud.com <mailto:pmwiki-devel at pmichaud.com>
>>> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>> _______________________________________________
>> pmwiki-devel mailing list
>> pmwiki-devel at pmichaud.com <mailto:pmwiki-devel at pmichaud.com>
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>>
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20190726/6a1ddbb1/attachment.html>
More information about the pmwiki-devel
mailing list