H !# Verbatim lines are starting with > (greater than) or tags g/^[^<>].*internet.*/s/internet/Internet/ g/^[^<>].*unicode.*/s/unicode/Unicode/ g/^[^<>].*interslavic.*/s/interslavic/Interslavic/ g/^[^<>].*artyom.*/s/artyom/Artyom/ g/^[^<>].*latin.*/s/latin/Latin/ g/^[^<>].*romaji.*/s/romaji/Romaji/ g/^[^<>].*lisp.*/s/lisp/Lisp/ g/^[^<>].*armascii.*/s/armascii/ArmASCII/ g/^[^<>].*html.*/s/html/HTML/ !# Capitalize I g/^[^<>].* i .*/s/ i / I /g g/^[^<>].* i'm .*/s/ i'm / I'm //g g/^[^<>].* i'd .*/s/ i'd / I'd //g g/^[^<>].* i'll .*/s/ i'll / I'll //g g/^\([^<>].* \)u\([ ,\;:—].*\)/s//\1you\2/g g/^\([^<>].* \)u r\([ ,\;:—].*\)/s//\1you are\2/g g/^\([^<>].* \)v r\([ ,\;:—].*\)/s//\1we are\2/g !# Abbreviations g/^[^<>].* abt .*/s/ abt / about / g/^\([^<>].* \)rll*y\([ ,;:—].*\)/s//\1really\2/ g/^\([^<>].* \)dunno\([ ,;:—].*\)/s//\1don’t know\2/ !# Insert smart quotes and other punctuation g/^[^<>].*"\\([^\"]*\\)"/s/"\\([^\"]*\\)"/“\\1”/g g/^[^<>].*\'/s/'/’/g g/^[^<>].*---/s/---/—/g !# Auto-terminate the terminator-less sentences g/^[^<>].*[^\;—:,.!?…]$/s//&./ !# Capitalize all sentences after a period g/^[^<>].*[.!?…]$/+1s/^š/Š/g\ s/^č/Č/g\ s/^ž/Ž/g\ s/^a/A/g\ s/^b/B/g\ s/^c/C/g\ s/^d/D/g\ s/^e/E/g\ s/^f/F/g\ s/^g/G/g\ s/^h/H/g\ s/^i/I/g\ s/^j/J/g\ s/^k/K/g\ s/^l/L/g\ s/^m/M/g\ s/^n/N/g\ s/^o/O/g\ s/^p/P/g\ s/^r/R/g\ s/^s/S/g\ s/^t/T/g\ s/^u/U/g\ s/^v/V/g\ s/^w/W/g\ s/^x/X/g\ s/^y/Y/g\ s/^z/Z/g !# Repeat second time for lines previously unmarked g/^[^>].*[.!?…]$/+1\ s/^š/Š/g\ s/^č/Č/g\ s/^ž/Ž/g\ s/^a/A/g\ s/^b/B/g\ s/^c/C/g\ s/^d/D/g\ s/^e/E/g\ s/^f/F/g\ s/^g/G/g\ s/^h/H/g\ s/^i/I/g\ s/^j/J/g\ s/^k/K/g\ s/^l/L/g\ s/^m/M/g\ s/^n/N/g\ s/^o/O/g\ s/^p/P/g\ s/^r/R/g\ s/^s/S/g\ s/^t/T/g\ s/^u/U/g\ s/^v/V/g\ s/^w/W/g\ s/^x/X/g\ s/^y/Y/g\ s/^z/Z/g !# And repeat for all the lines after paragraph opening g/

/+1\ s/^š/Š/g\ s/^č/Č/g\ s/^ž/Ž/g\ s/^a/A/g\ s/^b/B/g\ s/^c/C/g\ s/^d/D/g\ s/^e/E/g\ s/^f/F/g\ s/^g/G/g\ s/^h/H/g\ s/^i/I/g\ s/^j/J/g\ s/^k/K/g\ s/^l/L/g\ s/^m/M/g\ s/^n/N/g\ s/^o/O/g\ s/^p/P/g\ s/^r/R/g\ s/^s/S/g\ s/^t/T/g\ s/^u/U/g\ s/^v/V/g\ s/^w/W/g\ s/^x/X/g\ s/^y/Y/g\ s/^z/Z/g !# De-escape verbatim lines g/^> */s/// w q