[pmwiki-users] HTML entities
Patrick R. Michaud
pmichaud at pobox.com
Mon Oct 16 11:10:46 CDT 2006
On Fri, Oct 13, 2006 at 12:05:38AM +0200, Hannes Korte wrote:
> Patrick R. Michaud wrote:
> > This is exactly the question to be answered -- does Hannes
> > want non-ASCII characters converted to character entities
> > when the page is saved, or to be left alone in the markup
> > and converted when the page is output?
>
> I want the non-ASCII characters converted to the entities when the page
> is printed, so that you can edit the text more comfortably. Thanks for
> your hints, I think that I got it now. This works:
>
> Markup('html_entities', 'fulltext',
> "/(.*?)/ei",
> "convertspecialchars('$1')");
>
> function convertspecialchars($str) {
> $tr = array(
> 'Ä' => 'Ä', 'Ö' => 'Ö', 'Ü' => 'Ü',
> 'ä' => 'ä', 'ö' => 'Ö', 'ü' => 'ü',
> 'ß' => 'ß'
> );
> return strtr($str, $tr);
> }
>
> Do I use the Markup function correctly?
Close. You'll want to put a PSS(...) around the '$1'
so that quotes don't get slashes added in front of them:
Markup('html_entities', 'fulltext',
"/(.*?)/e",
"convertspecialchars(PSS('$1'))");
Pm
More information about the pmwiki-users
mailing list