From eb93b4173924364c9d3b0a4b0f1106b5d0796910 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 1 Jul 2018 13:47:34 -0700 Subject: [PATCH] Fix some whitespace --- src/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils.py b/src/utils.py index aa35d70..d97111d 100644 --- a/src/utils.py +++ b/src/utils.py @@ -16,11 +16,11 @@ def titleescape(s): Makes an article title filename-safe. """ s = s.strip() - s = re.sub(r"\s+", '_', s) # Replace whitespace with _ - s = parse.quote(s) # Encode all other characters - s = re.sub(r"%", "", s) # Strip encoding %s - if len(s) > 64: # If the result is unreasonably long, - s = hex(abs(hash(s)))[2:] # Replace it with a hex hash + s = re.sub(r"\s+", '_', s) # Replace whitespace with _ + s = parse.quote(s) # Encode all other characters + s = re.sub(r"%", "", s) # Strip encoding %s + if len(s) > 64: # If the result is unreasonably long, + s = hex(abs(hash(s)))[2:] # Replace it with a hex hash return s def titlestrip(s): @@ -72,4 +72,4 @@ def load_config(name): if config_value not in config: # TODO Not this either raise SystemExit("Error: {} not set in lexipython.cfg".format(config_value)) - return config \ No newline at end of file + return config