BigUpdate 0.5.0
Python application / build (push) Has been cancelled

- add Local Render Mermaid
- add page-starе для указания смещения страниц
- add Гиперссылки в документе на списки литературы
This commit is contained in:
Igor20264
2026-09-07 09:54:33 +03:00
parent ac0aa33399
commit 1a5b35eb54
29 changed files with 4118 additions and 69 deletions
+23
View File
@@ -56,6 +56,8 @@ class ConvertRequest:
open_when_done: bool = False
check_pages: bool = False
table_repeat_header: bool = False
# PAGE field start on body section; None = continuous from document start.
page_number_start: int | None = None
@dataclass
@@ -121,6 +123,20 @@ def _fix_front_matter_after_compose(document, *, had_title: bool, had_assignment
ensure_continuous_page_numbers(document)
def _apply_page_offset(document, req: ConvertRequest, *, had_title: bool, had_assignment: bool) -> None:
from .page_geometry import apply_page_number_start
start = getattr(req, "page_number_start", None)
if start is None:
return
try:
start_i = int(start)
except (TypeError, ValueError):
return
front = int(bool(had_title)) + int(bool(had_assignment))
apply_page_number_start(document, start_i, front_sections=front)
def convert(req: ConvertRequest, log: LogFn | None = None) -> ConvertResult:
"""Run check and/or conversion. Does not re-raise; errors go into ConvertResult."""
emit: LogFn = log if log is not None else print
@@ -255,6 +271,13 @@ def convert(req: ConvertRequest, log: LogFn | None = None) -> ConvertResult:
had_assignment=bool(req.assignment),
)
_apply_page_offset(
document,
req,
had_title=bool(req.title),
had_assignment=bool(req.assignment),
)
document.core_properties.author = getuser()
document.core_properties.comments = "Создано при помощи md2gost (ТЗ МИРЭА)"
try: