From: Stefan Huber Date: Tue, 1 Aug 2023 07:31:42 +0000 (+0200) Subject: bib2html.py: Add umlaut replacement X-Git-Url: https://git.sthu.org/?p=shutils.git;a=commitdiff_plain;h=794b05103d5e742df6b45dd738cc34689c2e93a7 bib2html.py: Add umlaut replacement --- diff --git a/bib2html.py b/bib2html.py index dee284e..5d5b4db 100755 --- a/bib2html.py +++ b/bib2html.py @@ -37,7 +37,25 @@ import os, sys, getopt, re def format_latex(text): # Get rid of matching dollar signs text = re.sub(r'\$([^\$]*)\$', r'\1', text) - return text.replace('\mathcal', '').replace('{', '').replace('}', '').replace('\\', '').replace('~', ' ').replace('--', '–') + + # Replace text + subst = { + '\\"a': 'ä', + '\\"o': 'ö', + '\\"u': 'u', + '\mathcal': '', + '{': '', + '}': '', + '\\': '', + '~': ' ', + '---': '–', + '--': '–', + } + + for a, b in subst.items(): + text = text.replace(a, b) + + return text def format_field_span(type, value): return "" + format_latex(value) + ""