feat: topology on its own landscape page, as large as possible

The topology image was shrunk inside the flex container used for rack
images. Each site's topology now gets a dedicated A4 landscape page
(named @page in PDF, landscape section in Word) with the section and
site headings, scaled to the full usable width or height depending on
its aspect ratio. The document switches back to portrait only when more
content follows, so no blank pages are produced. The TOC includes
headings on landscape pages.

Also fix Word exports without a template using US Letter instead of A4.

Bump version to 0.6.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 15:03:11 +02:00
co-authored by Claude Opus 5.5
parent 062413a2cd
commit e3c31b6312
7 changed files with 70 additions and 11 deletions
+11 -1
View File
@@ -28,7 +28,11 @@ class Document:
@property
def toc(self):
return [b for b in self.blocks if b.kind == "heading" and b.level <= 2]
out = []
for b in self.blocks:
headings = b.rows if b.kind == "landscape" else [b]
out += [h for h in headings if h.kind == "heading" and h.level <= 2]
return out
_anchor_counter = {"n": 0}
@@ -66,6 +70,12 @@ def IMAGES(images, wide=False):
return Block("images", images=out, level=1 if wide else 0) # level=1: volle Seitenbreite
def LANDSCAPE(headings, png):
"""Eigene Seite im Querformat: Überschriften + Bild so groß wie möglich (z.B. Topologie)."""
data_uri = "data:image/png;base64," + base64.b64encode(png).decode("ascii")
return Block("landscape", rows=list(headings), images=[{"svg": None, "png": png, "caption": "", "data_uri": data_uri}])
def PAGEBREAK():
return Block("pagebreak")