summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2009-03-21 14:45:53 +0100
committerThomas Schwinge <tschwinge@gnu.org>2009-03-21 14:45:53 +0100
commit224cb73643074f8f0654b688df7df13dd7b8ae4a (patch)
treebde3a9077e08ad7654114086aa375ea20ae44dfe
parent06280d468824c24b1f1ae59d5222a271a278b566 (diff)
purify_html: New.
-rwxr-xr-xpurify_html11
1 files changed, 11 insertions, 0 deletions
diff --git a/purify_html b/purify_html
new file mode 100755
index 00000000..a9ead881
--- /dev/null
+++ b/purify_html
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Un-mangle mailto links: convert HTML character entities to real characters.
+find ./ -name \*.html -print0 \
+ | xargs -0 \
+ perl -p -i -l -e \
+ 'BEGIN { $replacing = 0; }
+ # The replacing-toggling logic is a bit rough, but so is life.
+ $replacing = 1 if /<a href="mailto:/;
+ s%\&#(x?)([^;]*);%chr(length($1) ? hex($2) : $2)%eg if $replacing;
+ $replacing = 0 if /<\/a>/;'