Typography for markdown files

This commit is contained in:
Phyks 2014-08-07 22:38:43 +02:00
parent 0ef7a576e4
commit a6eb3e0c2c

View File

@ -73,8 +73,17 @@ def gfm(text):
text = re.sub(r'{gfm-extraction-([0-9a-f]{32})\}', pre_insert_callback,
text)
def handle_typography(text):
""" Add non breakable spaces before double punctuation signs."""
text = text.replace(' :', ' :')
text = text.replace(' ;', ' ;')
text = text.replace(' !', ' !')
text = text.replace(' ?', ' ?')
text = text.replace(' /', ' /')
return text
return handle_typography(text)
# Test suite.
try: