From a49fe8930964c7697d4818b29a9d9fe189ac7e66 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Sep 2009 12:00:39 -0600 Subject: [PATCH] TXT Output: Table support --- src/calibre/ebooks/txt/txtml.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/calibre/ebooks/txt/txtml.py b/src/calibre/ebooks/txt/txtml.py index 63a5cdc8af..6957e53d43 100644 --- a/src/calibre/ebooks/txt/txtml.py +++ b/src/calibre/ebooks/txt/txtml.py @@ -26,12 +26,18 @@ BLOCK_TAGS = [ 'h5', 'h6', 'li', + 'tr', ] BLOCK_STYLES = [ 'block', ] +SPACE_TAGS = [ + 'span', + 'td', +] + class TXTMLizer(object): def __init__(self, log): @@ -170,6 +176,10 @@ class TXTMLizer(object): if not end.endswith(u'\n\n') and hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '': text.append(u'\n\n') + if tag in SPACE_TAGS: + if not end.endswith('u ') and hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '': + text.append(u' ') + # Process tags that contain text. if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '': text.append(elem.text)