[Pmwiki-users] Entities in [[reference text]]

John Rankin john.rankin
Sun Jul 13 17:36:33 CDT 2003


Got it!

I'll have to do a bit more to get long vowels, as lower and upper case vowels with macrons aren't part of the HTML or XHTML DTD. So I need to translate Ā into Ā  ā into ā and so on.

A more general solution might be to apply all (most?) $InlineReplacements to $btext...

Now you have explained how to do it, I think I can solve my immediate problem. Thank you.
-- 
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

On Friday, 11 July 2003 11:03 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
John-

Here's a (possibly feeble) first attempt--add the following to local.php:

----

function FmtWikiLinkEntities($pat,$ref,$btext,$out=NULL,$pname=NULL) {
  if (!is_null($btext))
    $btext = preg_replace('/&amp;([A-Za-z0-9]+;|#\d+;)/','&$1',$btext);
  return FmtWikiLink($pat,$ref,$btext,$out,$pname);
}

function FmtUrlLinkEntities($pat,$ref,$btext) {
  if (!is_null($btext))
    $btext = preg_replace('/&amp;([A-Za-z0-9]+;|#\d+;)/','&$1',$btext);
  return FmtUrlLink($pat,$ref,$btext);
}

$FmtWikiLink = 'FmtWikiLinkEntities';
$FmtUrlLink = 'FmtUrlLinkEntities';

----

Basically this performs the &entity; substitution on double-bracket
replacement text (if present) prior to calling the normal WikiLink 
or UrlLink formatting routines.  In current versions of PmWiki this
won't work for mailto: links, but I think everything else should be
okay (I might have to check) depending on any local LinkPatterns that
are defined...

I have this implemented at 
    http://www.pmichaud.com/wiki/Development/EntitiesInBrackets
if you want to provide some test cases.

I'm not too adverse to modifying pmwiki.php to perform character entity
substitutions directly as part of the [[(something) (text)]] markup
handling routine, if we want to go that route.  This would make it
work everywhere rather than having to develop a lot of specialized
routines for it.  Anyone see any downsides?

Pm


On Fri, Jul 11, 2003 at 09:58:59AM +1200, John Rankin wrote:
> Does anybody know of a way to add a local customisation to allow entities inside PmWiki's double bracket markup?
> 
> We have a wiki that includes some text in Maori, which uses macrons to denote long vowels. The Hawaiian language has a similar structure. What we have done is defined &amacr; &emacr; etc to translate into the corresponding Unicode values. There is an $InlineReplacements customisation to do this; it's the convention used in the DocBook SGML DTD.
> 
> The limitation of this approach is that wiki markup of the form
>   [[http://www.some.place/ M&amacr;ori]]
> doesn't do what we would like it to.
> 
> It's not obvious to this writer how we might add a local function to parse the text bit of a double bracketed reference to look for entities and treat them as we would like to.
> 
> In an ideal world, we would allow WikiWords to include macron vowels, but that's in the too hard basket at the moment. One of the problems is that removing a macron can radically alter a word's meaning. A convention that's sometimes used is to double up the vowels to denote length. If I could handle macrons in the text of a [[...]]], I may be able to introduce an alternate free link markup to denote Maori page names:
> 
> ((Koohanga Reo)) -> [[KoohangeReo K&omacr;hanga Reo]]
> 
> Any suggestions would be welcome.
> -- 
> John Rankin
> 
> 
> 
> 
> _______________________________________________
> Pmwiki-users mailing list
> Pmwiki-users at pmichaud.com
> http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com
> 






More information about the pmwiki-users mailing list