Fix some whitespace
This commit is contained in:
parent
8fdba48fe7
commit
eb93b41739
12
src/utils.py
12
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
|
||||
return config
|
||||
|
|
Loading…
Reference in New Issue