mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
TXT Output: Table support
This commit is contained in:
parent
0428cf9bd6
commit
a49fe89309
@ -26,12 +26,18 @@ BLOCK_TAGS = [
|
|||||||
'h5',
|
'h5',
|
||||||
'h6',
|
'h6',
|
||||||
'li',
|
'li',
|
||||||
|
'tr',
|
||||||
]
|
]
|
||||||
|
|
||||||
BLOCK_STYLES = [
|
BLOCK_STYLES = [
|
||||||
'block',
|
'block',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
SPACE_TAGS = [
|
||||||
|
'span',
|
||||||
|
'td',
|
||||||
|
]
|
||||||
|
|
||||||
class TXTMLizer(object):
|
class TXTMLizer(object):
|
||||||
|
|
||||||
def __init__(self, log):
|
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() != '':
|
if not end.endswith(u'\n\n') and hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
||||||
text.append(u'\n\n')
|
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.
|
# Process tags that contain text.
|
||||||
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
|
||||||
text.append(elem.text)
|
text.append(elem.text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user