diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py
index f9f851dd3a..e86dfebe7c 100644
--- a/src/libprs500/__init__.py
+++ b/src/libprs500/__init__.py
@@ -33,7 +33,7 @@ You may have to adjust the GROUP and the location of the rules file to
suit your distribution.
"""
-__version__ = "0.3.36"
+__version__ = "0.3.37"
__docformat__ = "epytext"
__author__ = "Kovid Goyal element
self.book = book #: The Book object representing a BBeB book
@@ -766,7 +768,7 @@ class HTMLConverter(object):
if not self.disable_autorotation and width > self.profile.page_width and width > height:
pt = PersistentTemporaryFile(suffix='.jpeg')
- im = im.rotate(-90)
+ im = im.rotate(90)
im.convert('RGB').save(pt, 'JPEG')
path = pt.name
pt.close()
@@ -854,9 +856,9 @@ class HTMLConverter(object):
pass
elif tagname == 'a' and self.max_link_levels >= 0:
if tag.has_key('name'):
+ print tag, self.anchor_to_previous
if self.anchor_to_previous:
self.process_children(tag, tag_css)
- return
for c in self.anchor_to_previous.contents:
if isinstance(c, (TextBlock, ImageBlock)):
self.targets[tag['name']] = c
@@ -1049,7 +1051,7 @@ class HTMLConverter(object):
self.end_current_para()
if tagname.startswith('h'):
self.current_block.append(CR())
- elif tagname in ['b', 'strong', 'i', 'em', 'span']:
+ elif tagname in ['b', 'strong', 'i', 'em', 'span', 'tt']:
self.process_children(tag, tag_css)
elif tagname == 'font':
if tag.has_key('face'):
@@ -1057,12 +1059,15 @@ class HTMLConverter(object):
self.process_children(tag, tag_css)
elif tagname in ['br']:
self.current_para.append(CR())
- elif tagname == 'hr':
+ elif tagname in ['hr', 'tr']: # tr needed for nested tables
self.end_current_para()
self.current_block.append(CR())
self.end_current_block()
self.current_page.RuledLine(linelength=self.profile.page_width)
- elif tagname == 'table':
+ elif tagname == 'td': # Needed for nested tables
+ self.current_para.append(" ")
+ self.process_children(tag, tag_css)
+ elif tagname == 'table' and not self.in_table:
tag_css = self.tag_css(tag) # Table should not inherit CSS
self.process_table(tag, tag_css)
else:
diff --git a/src/libprs500/ebooks/lrf/html/demo/demo.html b/src/libprs500/ebooks/lrf/html/demo/demo.html
index 819022fb45..56f165a2c0 100644
--- a/src/libprs500/ebooks/lrf/html/demo/demo.html
+++ b/src/libprs500/ebooks/lrf/html/demo/demo.html
@@ -62,7 +62,7 @@
- Not that if you have custom fonts on your reader, the table may not be properly aligned. + Not that if you have custom fonts on your reader, the table may not be properly aligned. Also html2lrf does not support nested tables.
diff --git a/src/libprs500/ebooks/lrf/html/table.py b/src/libprs500/ebooks/lrf/html/table.py index 96f740e7aa..ff37e7d2a5 100644 --- a/src/libprs500/ebooks/lrf/html/table.py +++ b/src/libprs500/ebooks/lrf/html/table.py @@ -88,7 +88,6 @@ class Cell(object): pp = conv.current_page conv.book.allow_new_page = False - conv.anchor_to_previous = pp conv.current_page = conv.book.create_page() conv.parse_tag(cell, css) conv.end_current_block() @@ -96,8 +95,7 @@ class Cell(object): if isinstance(item, TextBlock): self.text_blocks.append(item) conv.current_page = pp - conv.book.allow_new_page = True - conv.anchor_to_previous = None + conv.book.allow_new_page = True if not self.text_blocks: tb = conv.book.create_text_block() tb.Paragraph(' ') @@ -223,9 +221,14 @@ class Table(object): self.rowpad = rowpad self.colpad = colpad rows = table.findAll('tr') + conv.anchor_to_previous = conv.current_page + conv.in_table = True for row in rows: rcss = conv.tag_css(row, css) self.rows.append(Row(conv, row, rcss, colpad)) + conv.in_table = False + conv.anchor_to_previous = None + def number_of_columns(self): max = 0