Merge branch 'master' of github.com:commandline/autocast

This commit is contained in:
Thomas Gideon 2011-10-23 20:36:56 -04:00
commit 64ce2f732c

View file

@ -235,14 +235,21 @@ def __archive_slug(title):
slug = re.sub(u'\u2013', '-', slug) slug = re.sub(u'\u2013', '-', slug)
slug = re.sub(u'\xd7', 'x', slug) slug = re.sub(u'\xd7', 'x', slug)
slug = re.sub(u'\u2019', '', 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) slug = re.sub(' {2,}', ' ', slug)
tokens = slug.split(' ') tokens = slug.split(' ')
tokens = [t.capitalize() for t in tokens] tokens = [__paren_capitalize(t) for t in tokens]
slug = ''.join(tokens) slug = ''.join(tokens)
return slug return slug
def __paren_capitalize(token):
if token.startswith('('):
token = token[1:]
return token.lower()
return token.capitalize()
def __main(feed_file): def __main(feed_file):
logging.basicConfig(level=logging.INFO, logging.basicConfig(level=logging.INFO,
format='%(message)s') format='%(message)s')