From 3ef9e4c9b2dfc21c4f729b0f8db1ef3b93d556fc Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 26 Mar 2011 13:25:02 -0400 Subject: [PATCH] Run smarty pants on Textile for quotes. --- src/calibre/ebooks/textile/functions.py | 5 +++-- src/calibre/ebooks/txt/input.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/textile/functions.py b/src/calibre/ebooks/textile/functions.py index b01a7bcdb7..39f793face 100755 --- a/src/calibre/ebooks/textile/functions.py +++ b/src/calibre/ebooks/textile/functions.py @@ -64,6 +64,8 @@ import re import uuid from urlparse import urlparse +from calibre.utils.smartypants import smartyPants + def _normalize_newlines(string): out = re.sub(r'\r\n', '\n', string) out = re.sub(r'\n{3,}', '\n\n', out) @@ -262,10 +264,9 @@ class Textile(object): self.rel = ' rel="%s"' % rel text = self.getRefs(text) - text = self.block(text, int(head_offset)) - text = self.retrieve(text) + text = smartyPants(text, 'q') return text diff --git a/src/calibre/ebooks/txt/input.py b/src/calibre/ebooks/txt/input.py index cad55b8c3f..99f7035800 100644 --- a/src/calibre/ebooks/txt/input.py +++ b/src/calibre/ebooks/txt/input.py @@ -165,7 +165,6 @@ class TXTInput(InputFormatPlugin): elif options.formatting_type == 'textile': log.debug('Running text through textile conversion...') html = convert_textile(txt) - #setattr(options, 'smarten_punctuation', True) else: log.debug('Running text through basic conversion...') flow_size = getattr(options, 'flow_size', 0)