-
-
13 Dec 2005 15:03:05 UTC
- Distribution: MathML-Entities-Approximate
- Module version: 0.20
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (472 / 0 / 0)
- Kwalitee
Bus factor: 0- 89.19% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (4.19KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- MathML::Entities
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
MathML::Entities::Approximate - Returns approximated ASCII characters for XHTML+MathML Named EntitiesSYNOPSIS
A subclass of MathML::Entities that supplies ASCII-approximate characters for XHTML+MathML Named Entities.
use lib (getpwnam('sdadmin'))[7] . '/perlib'; use MathML::Entities::Approximate; $html = '<strong>avancée</strong>'; # convert to HTML character reference. Standard MathML::Entities $numeric = name2numbered($html) # <strong>avancée</strong> # convert to standard ASCII $ascii = name2approximated($html) # <strong>avancee</strong> # Muck around with the lookup table... MathML::Entities::Approximate::getSet(aacute); # returns 'a' MathML::Entities::Approximate::getSet(aacute, z); # returns 'z' MathML::Entities::Approximate::getSet(aacute); # now returns 'z'DESCRIPTION
MathML::Entities::Approximate is a content conversion filter for named XHTML+MathML entities. There are over two thousand named entities in the XHTML+MathML DTD, however only a fraction of them are variants on standard ASCII characters.
A string is parsed and every Named Entity is converted to a reasonable ASCII (7-bit ASCII set), or removed from the string.
FUNCTIONS
There two functions, one of which is exported by default.
name2approximated
(Exported by default)
XHTML+MathML named entities in the argument of
name2approximated()are replaced by the corresponding 7-bit ASCII character. Any entitiy which cannot be approximated is removed.getSet
(Never Exported)
This method is provided to allow users to extend the internal
%APPROXIMATESlookup table: either alter an existing entry [for the life of the process] or add new entities.Of course, for a large update to the lookup table, you have the option of:
%MathML::Entities::Approximate:APPROXIMATES = ( %MathML::Entities::Approximate:APPROXIMATES, 'foobar' => 'fb', # LOWERCASE WELL SCUNNERED 'FooBar' => 'FB', # UPPERCASE WELL SCUNNERED 'landrover' => 'landie', # LOWERCASE PROPER MOTOR 'LandRover' => 'Landie' # UPPERCASE PROPER MOTOR );
AUTHOR
Ian Stuart <Ian.Stuart@ed.ac.uk>
COPYRIGHT
Copyright (c) 2005 Ian Stuart. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
MathML::Entities, HTML::Entities, HTML::Entities::Numbered, http://www.w3.org/TR/REC-html40/sgml/entities.html, http://www.w3.org/Math/characters/
Module Install Instructions
To install MathML::Entities::Approximate, copy and paste the appropriate command in to your terminal.
cpanm MathML::Entities::Approximateperl -MCPAN -e shell install MathML::Entities::ApproximateFor more information on module installation, please visit the detailed CPAN module installation guide.