blob: a9ead88193336c1f5d740144007753cd7d76bb3f (
plain)
1
2
3
4
5
6
7
8
9
10
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>/;'
|