From 2e4b6c030d1a8582ea429333684ec81b09ae31f1 Mon Sep 17 00:00:00 2001 From: kthoden Date: Mon, 25 May 2020 09:35:56 +0200 Subject: [PATCH] Don't escape en-dash, closes #50. --- src/data/aux/bibliography4ht.tex | 1 + src/utils/bib2html.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/data/aux/bibliography4ht.tex b/src/data/aux/bibliography4ht.tex index 19b2315..3a0e51c 100644 --- a/src/data/aux/bibliography4ht.tex +++ b/src/data/aux/bibliography4ht.tex @@ -86,6 +86,7 @@ \defbibheading{none}[]{} } \newcommand\greekfont{} +\newcommand\chinesefont{} \usepackage[autostyle]{csquotes} \usepackage[mincitenames=1,maxcitenames=3,maxbibnames=100,style=authoryear,backend=biber,autolang=hyphen,dateabbrev=false,datecirca=true,dateuncertain=true,dateera=christian,urldate=long,uniquename=false$usepackagebiblatex]{biblatex} \EOAbibtweaks diff --git a/src/utils/bib2html.py b/src/utils/bib2html.py index c2108aa..66455f0 100755 --- a/src/utils/bib2html.py +++ b/src/utils/bib2html.py @@ -96,11 +96,13 @@ def get_bibl_info( def latex_escape_non_ascii( input_str ): output = "" - # set hex value here, orginal value was 7f - escape_threshold = "ff" + escape_lower_threshold = 255 + # escape_upper_threshold = 8200 + escape_exceptions = [8211,] for c in input_str: - if ord(c) > int(escape_threshold, 16): + if ord(c) > escape_lower_threshold and ord(c) not in escape_exceptions : + # if escape_upper_threshold > ord(c) > escape_lower_threshold : output += "\entity{{{}}}".format( ord(c) ) else: output += c