[Pmwiki-users] Entities in [[reference text]]
Patrick R. Michaud
pmichaud at pobox.com
Thu Jul 10 18:03:53 CDT 2003
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('/&([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('/&([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 ā ē 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ā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ō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