mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-11-09 16:23:22 -05:00
21 lines
696 B
Python
21 lines
696 B
Python
# -*- coding: utf-8 -*-
|
||
|
||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||
|
||
__license__ = 'GPL 3'
|
||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||
__docformat__ = 'restructuredtext en'
|
||
|
||
import re
|
||
|
||
def unsmarten_text(txt):
|
||
txt = re.sub(u'–|–|–', r'--', txt) # en-dash
|
||
txt = re.sub(u'—|—|—', r'---', txt) # em-dash
|
||
txt = re.sub(u'…|…|…', r'...', txt) # ellipsis
|
||
|
||
txt = re.sub(u'“|”|″|“|”|″|“|”|″', r'"', txt) # double quote
|
||
txt = re.sub(u'‘|’|′|‘|’|′|‘|’|′', r"'", txt) # single quote
|
||
|
||
return txt
|
||
|