- fix Не появляется пустая странициа перед названием таблицы - fix Не появляется пустая страница перед альбомной ориентацией - fix При отказе от изменений создаётся новый файл - fix Замена "..." на «...» больше не затрагивает uml и mermaid блоки
This commit is contained in:
@@ -67,14 +67,23 @@ class Caption(Renderable):
|
||||
layout_state.max_width
|
||||
).calculate_height()
|
||||
|
||||
if self._before and ((height_data.lines + 2 - 1) * height_data.line_spacing + 1) * height_data.line_height \
|
||||
> layout_state.remaining_page_height:
|
||||
self._docx_paragraph.paragraph_format.page_break_before = True
|
||||
# Table/listing captions use keep_with_next. pageBreakBefore + keepWithNext
|
||||
# on a paragraph that Word already wraps to a new page produces a blank
|
||||
# page that the layout tracker / debug overlay never sees.
|
||||
leftover = 0
|
||||
need_new_page = (
|
||||
self._before
|
||||
and layout_state.current_page_height > 0
|
||||
and ((height_data.lines + 2 - 1) * height_data.line_spacing + 1) * height_data.line_height
|
||||
> layout_state.remaining_page_height
|
||||
)
|
||||
if need_new_page:
|
||||
leftover = layout_state.remaining_page_height
|
||||
height_data = ParagraphSizer(
|
||||
self._docx_paragraph,
|
||||
None,
|
||||
layout_state.max_width
|
||||
).calculate_height()
|
||||
|
||||
yield RenderedInfo(self._docx_paragraph, height_data.full + (layout_state.remaining_page_height
|
||||
if self._docx_paragraph.paragraph_format.page_break_before else 0))
|
||||
self._docx_paragraph.paragraph_format.page_break_before = False
|
||||
yield RenderedInfo(self._docx_paragraph, height_data.full + leftover)
|
||||
|
||||
Reference in New Issue
Block a user