ISO Latin -> HTML conversion
Danny Yee
danny at thrud.anatomy.usyd.edu.au
Sun Jul 9 07:42:46 EDT 2000
I solved my problem. The big performance hit was doing hundreds of
substitutions on every line. But there are only a few diacritics in
the body of text I am converting (this is to produce html versions of
a collection of 500 book reviews, from ISO Latin originals), so I did
a search before doing the substitutions.
special = re.compile("[²-þ]")
if special.search(line):
for pair in fix_list:
line = re.sub(pair[0], pair[1], line)
And that sped up a complete rebuild of the site from ten minutes to one!
http://dannyreviews.com/
Danny.
More information about the Python-list
mailing list