[pmwiki-devel] Pages names such as Tūroa

0 skatījumi
Pāriet uz pirmo nelasīto ziņojumu

Simon

nelasīta,
2019. gada 19. jūl. 22:15:3519.07.19
uz PmWiki Devel Mailing List
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

John Rankin

nelasīta,
2019. gada 19. jūl. 22:55:3419.07.19
uz pmwiki...@pmichaud.com

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

_______________________________________________
pmwiki-devel mailing list
pmwiki...@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Simon

nelasīta,
2019. gada 21. jūl. 06:32:3921.07.19
uz John Rankin,PmWiki Devel Mailing List
Thanks, it actually came about because I was trying to use [[!Tūroa]] for which there is no markup [[!Turoa|+]]

John Rankin

nelasīta,
2019. gada 22. jūl. 19:34:3122.07.19
uz Simon,PmWiki Devel Mailing List

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

John Rankin

nelasīta,
2019. gada 28. jūl. 13:36:5128.07.19
uz pmwiki...@pmichaud.com

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' => '&#256;',
    'a' => '&#257;',
    'E' => '&#274;',
    'e' => '&#275;',
    'I' => '&#298;',
    'i' => '&#299;',
    'O' => '&#332;',
    'o' => '&#333;',
    'U' => '&#362;',
    'u' => '&#363;');
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&#363;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

Atbildēt visiem
Atbildēt autoram
Pārsūtīt
0 jauni ziņojumi