aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-09-13 22:12:33 -0700
committerBryan Newbold <bnewbold@archive.org>2020-09-13 22:12:33 -0700
commit1b39abfa1c7233dd61dc49a267d7a8531646ba8f (patch)
tree013b58e11e4319cfb345e76ece415ea5270cec69
parent2dec107e37280b55dddae74cd0328f2d5c7979b6 (diff)
downloadchocula-1b39abfa1c7233dd61dc49a267d7a8531646ba8f.tar.gz
chocula-1b39abfa1c7233dd61dc49a267d7a8531646ba8f.zip
util: parse ISSN format with extra spaces
-rw-r--r--chocula/util.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/chocula/util.py b/chocula/util.py
index ce48ab6..b915e94 100644
--- a/chocula/util.py
+++ b/chocula/util.py
@@ -362,6 +362,7 @@ def test_clean_str():
def clean_issn(s: str) -> Optional[str]:
s = s.strip().upper()
+ s = s.replace(' ', '')
if len(s) == 8:
s = s[:4] + "-" + s[4:]
if len(s) != 9 or s[4] != "-":
@@ -373,3 +374,4 @@ def test_clean_issn():
assert clean_issn("1234-5678") == "1234-5678"
assert clean_issn(" 12345678") == "1234-5678"
assert clean_issn("123445678") == None
+ assert clean_issn("2249 - 8257") == "2249-8257"