mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #125
This commit is contained in:
parent
5e2ed7fb4d
commit
a79376875c
@ -1235,15 +1235,15 @@ class HTMLConverter(object):
|
||||
|
||||
def process_table(self, tag, tag_css):
|
||||
self.end_current_block()
|
||||
colpad = 10
|
||||
table = Table(self, tag, tag_css, rowpad=10, colpad=10)
|
||||
rowpad = 10
|
||||
table = Table(self, tag, tag_css, rowpad=rowpad, colpad=10)
|
||||
canvases = []
|
||||
for block, xpos, ypos, delta in table.blocks(int(self.current_page.pageStyle.attrs['textwidth'])):
|
||||
if not block:
|
||||
canvases.append(Canvas(int(self.current_page.pageStyle.attrs['textwidth']), ypos+colpad,
|
||||
canvases.append(Canvas(int(self.current_page.pageStyle.attrs['textwidth']), ypos+rowpad,
|
||||
blockrule='block-fixed'))
|
||||
else:
|
||||
canvases[-1].put_object(block, xpos + int(delta/2.), 0)
|
||||
canvases[-1].put_object(block, xpos + int(delta/2.), ypos)
|
||||
|
||||
for canvas in canvases:
|
||||
self.current_page.append(canvas)
|
||||
|
@ -184,7 +184,11 @@ class Cell(object):
|
||||
self.pts_to_pixels(attrs.get('linespace', ts['linespace']))
|
||||
ws = self.pts_to_pixels(attrs.get('wordspace', ts['wordspace']))
|
||||
if isinstance(token, int): # Handle para and line breaks
|
||||
top = bottom
|
||||
if top != bottom: #Previous element not a line break
|
||||
top = bottom
|
||||
else:
|
||||
top += ls
|
||||
bottom += ls
|
||||
left = parindent if int == 1 else 0
|
||||
continue
|
||||
if isinstance(token, Plot):
|
||||
@ -310,7 +314,7 @@ class Table(object):
|
||||
|
||||
def get_widths(self, maxwidth):
|
||||
'''
|
||||
Return widths of columns + sefl.colpad
|
||||
Return widths of columns + self.colpad
|
||||
'''
|
||||
rows, cols = self.number_or_rows(), self.number_of_columns()
|
||||
widths = range(cols)
|
||||
@ -376,12 +380,13 @@ class Table(object):
|
||||
cell = cellmatrix[r][c]
|
||||
if not cell:
|
||||
continue
|
||||
width = sum(widths[c:c+cell.colspan])
|
||||
width = sum(widths[c:c+cell.colspan])-self.colpad*cell.colspan
|
||||
sypos = 0
|
||||
for tb in cell.text_blocks:
|
||||
tb.blockStyle = self.conv.book.create_block_style(
|
||||
blockwidth=width,
|
||||
blockheight=cell.text_block_size(tb, width)[1])
|
||||
blockheight=cell.text_block_size(tb, width)[1],
|
||||
blockrule='horz-fixed')
|
||||
|
||||
yield tb, xpos[c], sypos, delta
|
||||
sypos += tb.blockStyle.attrs['blockheight']
|
||||
|
Loading…
x
Reference in New Issue
Block a user