fix(odt): remove stray blank paragraph from template (#42)
The template contained an empty <text:p/> that was rendered as a blank line before the report header. After loading the template, strip all text:p children so that ODT output no longer depends on template editing artifacts. Closes #42.
This commit is contained in:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "redmine-reporter"
|
name = "redmine-reporter"
|
||||||
version = "1.8.0"
|
version = "1.8.1"
|
||||||
description = "Redmine time-entry based issue reporter for internal use"
|
description = "Redmine time-entry based issue reporter for internal use"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "Artem Kokos", email = "artem-kokos@mail.ru" }]
|
authors = [{ name = "Artem Kokos", email = "artem-kokos@mail.ru" }]
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ class ODTFormatter(Formatter):
|
|||||||
with resources.files("redmine_reporter").joinpath("templates/template.odt").open("rb") as f:
|
with resources.files("redmine_reporter").joinpath("templates/template.odt").open("rb") as f:
|
||||||
doc = load(f)
|
doc = load(f)
|
||||||
|
|
||||||
|
# Удаляем все текстовые параграфы из шаблона, оставляя только
|
||||||
|
# структурные элементы (forms, sequence-decls). Это защищает от
|
||||||
|
# артефактов редактирования шаблона в LibreOffice (#42).
|
||||||
|
for child in list(doc.text.childNodes):
|
||||||
|
if child.tagName == "text:p":
|
||||||
|
doc.text.removeChild(child)
|
||||||
|
|
||||||
para_style_name = "Standard"
|
para_style_name = "Standard"
|
||||||
|
|
||||||
# Заголовок
|
# Заголовок
|
||||||
|
|||||||
Reference in New Issue
Block a user