Created
September 5, 2013 12:24
-
-
Save llelf/6449417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Modern::Perl; | |
while (<>) { | |
# Kill | |
s{<abr>\w+</abr> \s+ <rref>.*wav</rref>}{}xg; | |
s{<rref>.*\.(wav|jpg)</rref>}{}g; | |
# Head | |
s{<k>.*</k>}{}; | |
my $pron = qr{(?:[^<>]|<i>|</i>)+}; | |
s{ /($pron)/([[:punct:][:space:]])}{ <span class="pr">| $1 |</span>$2}g; | |
# s{<span class="pr">\| ($pron) \$ ($pron) \|</span>} | |
# {<span class="pr">| $1 |<span>, <span class="pr">| $2 |</span>}g; | |
#s{<c c="blue">((?:.(!?</c>))+.)</c>}{<span class="h">$1</span>}; | |
s{^(?:<blockquote>){2} (.*) (?:</blockquote>){2}}{<div class="topquote">$1</div>}x; | |
s{<b>(\d+)</b>\.}{$1}; | |
s{^<b>[[:upper:]]+\.</b>}{}; | |
s{<ex>((?:.(?!</ex>))*.)</ex>}{<span class="ex">$1</span>}g; | |
s{ – }{ — }g; | |
my $def = qr{<b><c c="dimgray">([\w\s/]+)</c></b>}; | |
s{$def}{<span class="def">\L$1\E</span>}g; | |
s{<i>(\s?\w+)</i>}{<i>$1 </i>}g; | |
# Requote | |
my $topquote = qr{<div class="topquote">}; | |
s{$topquote ((?:<blockquote>){2})}{<div class="topquote q2">$1}x; | |
s{$topquote (<blockquote>)}{<div class="topquote q1">$1}x; | |
print; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment