v0.5.3
- Мелкие исправления увеличивающие работу конвертера
This commit is contained in:
@@ -79,6 +79,7 @@ class Image(Renderable, RequiresNumbering):
|
||||
logging.warning("SVG blip attach failed (%s): %s", svg_path, exc)
|
||||
|
||||
self._number = None
|
||||
self._caption: Caption | None = None
|
||||
self.landscape = bool(caption_info and caption_info.landscape)
|
||||
if caption_info and caption_info.unique_name:
|
||||
self.unique_name = caption_info.unique_name
|
||||
@@ -89,6 +90,21 @@ class Image(Renderable, RequiresNumbering):
|
||||
|
||||
def set_number(self, number: str):
|
||||
self._number = number
|
||||
self._caption = None
|
||||
|
||||
def _get_caption(self) -> Caption:
|
||||
"""One caption object per figure.
|
||||
|
||||
Paragraph.render() lays a figure out once to learn its height and the
|
||||
Renderer then renders it for real; a shared caption keeps the second
|
||||
pass from re-measuring the same line.
|
||||
"""
|
||||
if self._caption is None:
|
||||
self._caption = Caption(
|
||||
self._parent, "Рисунок", self._caption_info, self._number, False
|
||||
)
|
||||
self._caption.center()
|
||||
return self._caption
|
||||
|
||||
def _reset_native_size(self) -> None:
|
||||
if self._image is None or self._native_width is None or self._native_height is None:
|
||||
@@ -142,7 +158,4 @@ class Image(Renderable, RequiresNumbering):
|
||||
|
||||
layout_state.add_height(rendered_image.height)
|
||||
|
||||
caption = Caption(self._parent, "Рисунок", self._caption_info, self._number, False)
|
||||
caption.center()
|
||||
|
||||
yield from caption.render(rendered_image, copy(layout_state))
|
||||
yield from self._get_caption().render(rendered_image, copy(layout_state))
|
||||
|
||||
Reference in New Issue
Block a user