Merge branch 'master' of github.com:commandline/autocast
This commit is contained in:
commit
64ce2f732c
1 changed files with 9 additions and 2 deletions
11
append.py
11
append.py
|
@ -235,14 +235,21 @@ def __archive_slug(title):
|
|||
slug = re.sub(u'\u2013', '-', slug)
|
||||
slug = re.sub(u'\xd7', 'x', slug)
|
||||
slug = re.sub(u'\u2019', '', slug)
|
||||
slug = re.sub('[^A-Za-z0-9\-\.]', ' ', slug)
|
||||
slug = re.sub('[^A-Za-z0-9\-\.(]', ' ', slug)
|
||||
slug = re.sub(' {2,}', ' ', slug)
|
||||
tokens = slug.split(' ')
|
||||
tokens = [t.capitalize() for t in tokens]
|
||||
tokens = [__paren_capitalize(t) for t in tokens]
|
||||
slug = ''.join(tokens)
|
||||
return slug
|
||||
|
||||
|
||||
def __paren_capitalize(token):
|
||||
if token.startswith('('):
|
||||
token = token[1:]
|
||||
return token.lower()
|
||||
return token.capitalize()
|
||||
|
||||
|
||||
def __main(feed_file):
|
||||
logging.basicConfig(level=logging.INFO,
|
||||
format='%(message)s')
|
||||
|
|
Loading…
Reference in a new issue