#!/usr/bin/perl -w # Entitymapping: Blosxom plugin to map various ASCII symbols into HTML entities # D.F. Simola, http://dfsimola.com # Taken from: # http://tlt.its.psu.edu/suggestions/international/web/codehtml.html # http://www.starr.net/is/type/htmlcodes.html # http://www.htmlhelp.com/reference/html40/entities/ # Version 1.0 # Wed,10 Jan 2007, 19:54:50 package entitymapping; use strict; use vars qw($VERSION); $VERSION = "1.0"; sub start { 1; } sub story { my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_; $$title_ref = encode_entity($$title_ref); $$body_ref = encode_entity($$body_ref); 1; } sub encode_entity { my $html = shift; # text to be parsed # puncuation - could use smarty pants, but have these # in case you don't # dashes $html =~ s/—/—/g; $html =~ s/–/–/g; $html =~ s/…/…/g; # symbols $html =~ s/°/°/g; $html =~ s/º/°/g; $html =~ s/©/©/g; $html =~ s/®/®/g; # currency $html =~ s/¢/¢/g; $html =~ s/£/£/g; $html =~ s/€/€/g; # greek characters $html =~ s/π/π/g; $html =~ s/∑/Σ/g; $html =~ s/ß/β/g; $html =~ s/∂/δ/g; $html =~ s/∆/Δ/g; $html =~ s/µ/µ/g; # acute $html =~ s/é/é/g; # grave $html =~ s/à/à/g; # circumflex # tilde $html =~ s/ã/ã/g; $html =~ s/Ã/Ã/g; $html =~ s/ñ/ñ/g; $html =~ s/Ñ/Ñ/g; $html =~ s/õ/õ/g; $html =~ s/Õ/Õ/g; # umlaut $html =~ s/ä/ä/g; $html =~ s/ë/ë/g; $html =~ s/ï/ï/g; $html =~ s/ö/ö/g; $html =~ s/ü/ü/g; $html =~ s/ÿ/%yuml;/g; $html =~ s/Ä/Ä/g; $html =~ s/Ë/Ë/g; $html =~ s/Ï/Ï/g; $html =~ s/Ö/Ö/g; $html =~ s/Ü/Ü/g; $html =~ s/Ÿ/%Yuml;/g; # arrows $html =~ s/←/←/g; $html =~ s/→/→/g; $html =~ s/↑/↑/g; $html =~ s/↓/↓/g; $html =~ s/↔/↔/g; $html =~ s/↵/↵/g; return $html; } 1; __END__