Current Version: 0.1.2 (9/24/2009)
Introduction
XHTML defines hundreds of "named entities", like ©
(©), Φ
(Φ) and €
(€). MathML defines thousands more, like &conint
(∮). Web browsers know how to handle XHTML named entities, and MathML-aware browsers know how to handle MathML named entities as well.
But a generic XML parser (as, say, might be built into your Atom Feed Reader) does not. It only knows about the five entities defined in XML 1.0: &
(&), <
(<) >
(>) '
(') and "
("). Such a parser will barf if you try — as Atom allows — to embed XHTML content containing named entities into your feed.
The solution is to convert all your named entities into numeric character references. So, e.g., €
becomes €
or
&conint
becomes ∮
. Web browsers and generic XML parsers will handle these numeric character references just fine.
This package contains an MT plugin to do the conversion for you. The plugin adds a global filter, which you can use in your templates:
<MTEntryBody numeric_entities="1">
The named entities supported by this version are described in the W3C document XML Entity definitions for Characters.
Installation
- Download and unpack the distribution.
- Place the contents of the
plugins
folder in your MTplugins
folder and the contents of theextlib
folder in your MTextlib
folder. Be careful: these folders already have files in them. Don't overwrite them!
Standalone Perl Module
Non-MT user may be interested in the standalone Perl Module version:
use MathML::Entities;
$conv2refs = name2numbered($string); # numeric character refs $conv2utf8 = name2utf8($string); # utf-8 characters
As with any Perl module, installation is as simple as
perl Makefile.PL make make test make install
Better yet, you can install it via CPAN.