gist: Embiggen the awesome of your text dissertations through ligature abuse, 2011-04-02 12:45:12Z
#/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
if sys.version_info < (3,):
raise Exception("This requires Python 3 to run. Sorry.")
ligatures = { "db": "ȸ",
"AE": "Æ",
"ae": "æ",
"OE": "Œ",
"oe": "œ",
"ue": "ᵫ",
"ff": "ff",
"IJ": "IJ",
"ij": "ij",
"fi": "fi",
"fl": "fl",
"ffi": "ffi",
"ffi": "ffi",
"ffi": "ffi",
"ffl": "ffl",
"ffi": "ffl",
"ffl": "ffl",
"ffl": "ffl",
"ft": "ſt",
"OI": "Ƣ",
"oi": "ƣ",
"IJ": "IJ",
"ij": "ij",
"qp": "ȹ",
"st": "st",
"ſt": "st",
}
additional_ligatures = { "et": "&",
"SS": "ẞ",
"ss": "ß",
}
digraphs = { "DZ": "DZ",
"Dz": "Dz",
"dz": "dz",
"DŽ": "DŽ",
"Dž": "Dž",
"dž": "dž",
"LJ": "LJ",
"Lj": "Lj",
"lj": "lj",
"NJ": "NJ",
"Nj": "Nj",
"nj": "nj",
}
text = sys.stdin.read()
for replacement_list in [ligatures, digraphs]:
for letters, replacement in replacement_list.items():
text = text.replace(letters, replacement)
sys.stdout.write(text)