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):
|
def process_table(self, tag, tag_css):
|
||||||
self.end_current_block()
|
self.end_current_block()
|
||||||
colpad = 10
|
rowpad = 10
|
||||||
table = Table(self, tag, tag_css, rowpad=10, colpad=10)
|
table = Table(self, tag, tag_css, rowpad=rowpad, colpad=10)
|
||||||
canvases = []
|
canvases = []
|
||||||
for block, xpos, ypos, delta in table.blocks(int(self.current_page.pageStyle.attrs['textwidth'])):
|
for block, xpos, ypos, delta in table.blocks(int(self.current_page.pageStyle.attrs['textwidth'])):
|
||||||
if not block:
|
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'))
|
blockrule='block-fixed'))
|
||||||
else:
|
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:
|
for canvas in canvases:
|
||||||
self.current_page.append(canvas)
|
self.current_page.append(canvas)
|
||||||
|
@ -184,7 +184,11 @@ class Cell(object):
|
|||||||
self.pts_to_pixels(attrs.get('linespace', ts['linespace']))
|
self.pts_to_pixels(attrs.get('linespace', ts['linespace']))
|
||||||
ws = self.pts_to_pixels(attrs.get('wordspace', ts['wordspace']))
|
ws = self.pts_to_pixels(attrs.get('wordspace', ts['wordspace']))
|
||||||
if isinstance(token, int): # Handle para and line breaks
|
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
|
left = parindent if int == 1 else 0
|
||||||
continue
|
continue
|
||||||
if isinstance(token, Plot):
|
if isinstance(token, Plot):
|
||||||
@ -310,7 +314,7 @@ class Table(object):
|
|||||||
|
|
||||||
def get_widths(self, maxwidth):
|
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()
|
rows, cols = self.number_or_rows(), self.number_of_columns()
|
||||||
widths = range(cols)
|
widths = range(cols)
|
||||||
@ -376,16 +380,17 @@ class Table(object):
|
|||||||
cell = cellmatrix[r][c]
|
cell = cellmatrix[r][c]
|
||||||
if not cell:
|
if not cell:
|
||||||
continue
|
continue
|
||||||
width = sum(widths[c:c+cell.colspan])
|
width = sum(widths[c:c+cell.colspan])-self.colpad*cell.colspan
|
||||||
sypos = 0
|
sypos = 0
|
||||||
for tb in cell.text_blocks:
|
for tb in cell.text_blocks:
|
||||||
tb.blockStyle = self.conv.book.create_block_style(
|
tb.blockStyle = self.conv.book.create_block_style(
|
||||||
blockwidth=width,
|
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
|
yield tb, xpos[c], sypos, delta
|
||||||
sypos += tb.blockStyle.attrs['blockheight']
|
sypos += tb.blockStyle.attrs['blockheight']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user