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