From 794b05103d5e742df6b45dd738cc34689c2e93a7 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Tue, 1 Aug 2023 09:31:42 +0200 Subject: [PATCH] bib2html.py: Add umlaut replacement --- bib2html.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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) + "" -- 2.30.2