mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Smarten punctuation: Fix double dashes and triple dots being smartened even inside attribute values. Fixes #1598465 [Problem with smarten punctuation when using ebook-convert](https://bugs.launchpad.net/calibre/+bug/1598465)
There was a postprocess step that calibre was doing after the call to smartypants that was unneccessary and was causing this bug.
This commit is contained in:
parent
88e3e0fb9f
commit
44ae597f14
@ -62,7 +62,7 @@ def wrap_lines(match):
|
||||
else:
|
||||
return ital+' '
|
||||
|
||||
def smarten_punctuation(html, log):
|
||||
def smarten_punctuation(html, log=None):
|
||||
from calibre.utils.smartypants import smartyPants
|
||||
from calibre.ebooks.chardet import substitute_entites
|
||||
from calibre.ebooks.conversion.utils import HeuristicProcessor
|
||||
@ -76,10 +76,6 @@ def smarten_punctuation(html, log):
|
||||
html = smartyPants(html)
|
||||
html = html.replace(start, '<!--')
|
||||
html = html.replace(stop, '-->')
|
||||
# convert ellipsis to entities to prevent wrapping
|
||||
html = re.sub(r'(?u)(?<=\w)\s?(\.\s?){2}\.', '…', html)
|
||||
# convert double dashes to em-dash
|
||||
html = re.sub(r'\s--\s', u'\u2014', html)
|
||||
return substitute_entites(html)
|
||||
|
||||
class DocAnalysis(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user