Skip to content

Commit 4c0cf08

Browse files
committed
fixes
1 parent 235c5d2 commit 4c0cf08

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

bibolamazi/filters/fixes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@
142142

143143

144144

145-
_rx_pages_ranges = re.compile(r'^\s*(?P<a>\w+)\s*\{\s*?'
146-
r'(?P<hyphen>[-'
145+
_rx_pages_ranges = re.compile(r'^\s*(?P<a>[0-9A-Za-z./]+)\s*\{?\s*'
146+
r'(?P<hyphen>(?:[-'
147147
'\u2010\u2011\u2012\u2013\u2014\u2015\u2E3A\u2E3B\uFE58\uFE63'
148-
r']+)'
149-
r'\s*\}?\s*(?P<b>\w+)\s*$')
148+
r']|\\(?:textendash|textemdash)\b)+)'
149+
r'\s*\}?\s*(?P<b>[0-9A-Za-z./]+)\s*$')
150150

151151

152152

test/test_filters_fixes.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ def test_rest(self):
924924
("Uhlmann1973_EdDMII", Entry("article", persons={"author": [Person("Uhlmann, Armin")],}, fields={
925925
"file": ":path/to/Mendeley/Uhlmann - 1973 - Endlich-dimensionale Dichtematrizen II.pdf:pdf",
926926
"journal": "Wiss. Z. Karl-Marx-Univ. Leipzig, Math.-Naturwiss.",
927-
"pages": "139--177",
927+
"pages": "139-177",
928928
"title": "{Endlich-dimensionale Dichtematrizen II}",
929929
"url": "http://www.physik.uni-leipzig.de/$\\sim$uhlmann/papers.html",
930930
"volume": "22",
@@ -939,7 +939,7 @@ def test_rest(self):
939939
"mendeley-tags": "thermo",
940940
"month": "November",
941941
"number": "11-12",
942-
"pages": "840--856",
942+
"pages": "840{–}856",
943943
"publisher": "Springer Berlin / Heidelberg",
944944
"title": "{\\\"{U}ber die Entropieverminderung in einem thermodynamischen System bei Eingriffen intelligenter Wesen}",
945945
"url": "http://www.springerlink.com/index/10.1007/BF01341281",
@@ -979,7 +979,7 @@ def test_rest(self):
979979
"mendeley-tags": "thermo",
980980
"month": "March",
981981
"number": "1",
982-
"pages": "1--40",
982+
"pages": r"1{\textendash}40",
983983
"title": "Exorcist XIV: The Wrath of Maxwell\u2019s Demon. Part II. From Szilard to Landauer and Beyond",
984984
"url": "http://linkinghub.elsevier.com/retrieve/pii/S1355219898000264",
985985
"volume": "30",
@@ -993,7 +993,7 @@ def test_rest(self):
993993
"journal": "Physical Review A",
994994
"month": "nov",
995995
"number": "5",
996-
"pages": "4247--4247",
996+
"pages": "4247-x-4247",
997997
"title": "Reply to ``Comment on `Optical coherence: A convenient fiction'''",
998998
"extrafield": "Reply to “Comment on ‘Optical coherence: A convenient fiction’”",
999999
"url": "http://link.aps.org/doi/10.1103/PhysRevA.58.4247",
@@ -1019,7 +1019,9 @@ def test_rest(self):
10191019
convert_dbl_quotes=True,
10201020
convert_sgl_quotes=['title','abstract','booktitle','series','extrafield'],
10211021
dbl_quote_macro=r'\enquote',
1022-
sgl_quote_macro=r'\enquote*')
1022+
sgl_quote_macro=r'\enquote*',
1023+
fix_pages_range=True,
1024+
)
10231025

10241026
for k,e in entries:
10251027
e.key = k
@@ -1274,7 +1276,7 @@ def test_rest(self):
12741276
"journal": "Physical Review A",
12751277
"month": "nov",
12761278
"number": "5",
1277-
"pages": "4247--4247",
1279+
"pages": "4247-x-4247", # didn't match page range, should leave it alone
12781280
"title": "Reply to \\enquote{Comment on \\enquote*{Optical coherence: {A} convenient fiction}}",
12791281
"extrafield": "Reply to “Comment on \\enquote*{Optical coherence: A convenient fiction}”",
12801282
"url": "http://link.aps.org/doi/10.1103/PhysRevA.58.4247",

0 commit comments

Comments
 (0)