diff options
Diffstat (limited to 'purify_html')
-rwxr-xr-x | purify_html | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/purify_html b/purify_html new file mode 100755 index 00000000..4cf582af --- /dev/null +++ b/purify_html @@ -0,0 +1,15 @@ +#!/bin/sh + +# Mangle the rendered files to cause fewer differernces upon re-rendering. + +# Written by Thomas Schwinge <tschwinge@gnu.org>. + +# 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>/;' |