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 "<span class=bibentry_" + type + ">" + format_latex(value) + "</span>"