From d6ec680ebbbadc659a09105d66aaa60299ac1be9 Mon Sep 17 00:00:00 2001 From: John Schember Date: Mon, 9 May 2011 06:43:19 -0400 Subject: [PATCH] Leigh's latest changes. --- src/calibre/ebooks/textile/functions.py | 2 +- src/calibre/ebooks/txt/textileml.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/textile/functions.py b/src/calibre/ebooks/textile/functions.py index dd1914cf9f..b186e79ad4 100755 --- a/src/calibre/ebooks/textile/functions.py +++ b/src/calibre/ebooks/textile/functions.py @@ -792,6 +792,7 @@ class Textile(object): text = self.noTextile(text) text = self.code(text) + text = self.glyphs(text) text = self.links(text) if not self.noimage: @@ -803,7 +804,6 @@ class Textile(object): text = self.span(text) text = self.footnoteRef(text) - text = self.glyphs(text) return text.rstrip('\n') diff --git a/src/calibre/ebooks/txt/textileml.py b/src/calibre/ebooks/txt/textileml.py index 2f04c4676b..082332ffd8 100644 --- a/src/calibre/ebooks/txt/textileml.py +++ b/src/calibre/ebooks/txt/textileml.py @@ -69,8 +69,8 @@ class TextileMLizer(OEB2HTML): txt = '%s' % t if txt != '%': text = re.sub(r'([^'+t+'|^\n])'+t+t+'([^'+t+'])', r'\1\2', text) - text = re.sub(r'(\w)('+t+'\w+'+t+')', r'\1[\2]', text) - text = re.sub(r'('+t+'\w+'+t+')(\w)', r'[\1]\2', text) + text = re.sub(r'([a-zA-Z0-9\'"\-])('+t+'[a-zA-Z0-9\'"!? ,.\-]+'+t+')', r'\1[\2]', text) + text = re.sub(r'('+t+'[a-zA-Z0-9\'"!? ,.\-]+'+t+')([a-zA-Z0-9\'"!?\-])', r'[\1]\2', text) return text # Now tidyup links and ids - remove ones that don't have a correponding opposite