Files
bamort/backend/templates/Default_A4_Quer/page_3.html
T
Frank 59fe69d35d refactor: Unify PDF pagination system and rename templates
BREAKING CHANGE: Template names changed from page1_stats.html to page_1.html

## Phase 1: Unified Pagination Function
- Implemented PaginateMultiList() to replace PaginateSkills(), PaginateSpells(), and PaginatePage2PlayLists()
- Single metadata-driven function handles all list types (skills, weapons, spells, equipment)
- Properly handles filters (learned/unlearned/language) via template metadata
- Shares list trackers by ListType+Filter combination to avoid duplication
- Added comprehensive tests for all edge cases

## Phase 2: Template Naming Convention
- Renamed templates to be data-agnostic:
  - page1_stats.html -> page_1.html
  - page1.2_stats.html -> page_1.2.html
  - page2_play.html -> page_2.html
  - page2.2_play.html -> page_2.2.html
  - page3_spell.html -> page_3.html
  - page3.2_spell.html -> page_3.2.html
  - page4_equip.html -> page_4.html
- Updated GenerateContinuationTemplateName() for new naming (page_1.html -> page_1.2.html)
- Updated ExtractBaseTemplateName() to handle new format
- Updated all test files and source files with new template names

## Phase 3: Simplified RenderPageWithContinuations
- Removed hardcoded switch statements based on template names
- Replaced with generic dataMap and unified pagination call
- Extracted populatePageDataFromDistribution() to handle data mapping
- Template type detection now driven by metadata, not hardcoded names

## Benefits
-  Extensibility: Add new templates without code changes
-  Maintainability: One pagination algorithm instead of three
-  Clarity: Template names reflect page numbers, not content types
-  Flexibility: Templates can mix any data types
-  All 40+ tests passing

## Technical Details
- Added SkillsColumn3 and SkillsColumn4 fields to PageData for continuation pages
- Template metadata loaded from HTML comments drives pagination behavior
- Backward compatibility maintained for old template references in comments
2025-12-21 22:07:46 +01:00

100 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zauberblatt - {{.Character.Name}}</title>
<link rel="stylesheet" href="shared/export_format_a4_quer.css">
</head>
<body>
<div class="container">
<div class="header">
<span class="header-left">Zauberblatt</span>
<span class="header-right">Datum: {{.Meta.Date}}</span>
</div>
<div class="title-row">
<img src="shared/images/headerimg.png" alt="Schmuckgrafik" class="header-decoration">
<div class="info-box">
<div><strong>Figur</strong> &nbsp; {{.Character.Name}} &nbsp; <strong>Grad</strong> &nbsp; {{.Character.Grade}}</div>
<hr>
<div><strong>Typ</strong> &nbsp; {{.Character.Type}} &nbsp; <strong>Zaubern</strong> &nbsp; + {{.DerivedValues.Zaubern}}</div>
</div>
<img src="shared/images/headerimg.png" alt="Schmuckgrafik" class="header-decoration">
</div>
<div class="flex main-content">
<!-- Left spell table -->
<div class="left-section">
<!-- BLOCK: spells_left, TYPE: spells, MAX: 15 -->
<table class="spells-table">
<tr>
<th>AP<hr>Prozess *</th>
<th>Zauber</th>
<th>Zauberdauer<hr>Reichweite</th>
<th>Wirkungsbereich<hr>Wirkungsdauer</th>
<th>Wirkung</th>
<th>Wirk.ziel<hr>Art</th>
</tr>
{{range .SpellsLeft}}
<tr>
<td>{{.AP}}<hr>{{.Category}}&nbsp;</td>
<td>{{.Name}}</td>
<td>{{.Zauberdauer}}&nbsp;<hr>{{.Reichweite}}&nbsp;</td>
<td>{{.Wirkungsbereich}}&nbsp;<hr>{{.Wirkungsdauer}}&nbsp;</td>
<td>{{.Beschreibung}}&nbsp;</td>
<td>{{.Wirkungsziel}}&nbsp;<hr>{{.Art}}&nbsp;</td>
</tr>
{{end}}
</table>
</div>
<!-- Right spell table -->
<div class="right-section">
<!-- BLOCK: spells_right, TYPE: spells, MAX: 10 -->
<table class="spells-table">
<tr>
<th>AP<br>Prozess *</th>
<th>Zauber</th>
<th>Zauberdauer<br>Reichweite</th>
<th>Wirkungsbereich<br>Wirkungsdauer</th>
<th>Wirkung</th>
<th>Wirk.ziel<br>Art</th>
</tr>
{{range .SpellsRight}}
<tr>
<td>{{.AP}}&nbsp;<hr>{{.Category}}&nbsp;</td>
<td>{{.Name}}</td>
<td>{{.Zauberdauer}}&nbsp;<hr>{{.Reichweite}}&nbsp;</td>
<td>{{.Wirkungsbereich}}&nbsp;<hr>{{.Wirkungsdauer}}&nbsp;</td>
<td>{{.Beschreibung}}&nbsp;</td>
<td>{{.Wirkungsziel}}&nbsp;<hr>{{.Art}}&nbsp;</td>
</tr>
{{end}}
</table>
<div class="spell-footer">
<p><em>wichtige magische Gegenstände, Tränke, Schriftrollen</em></p>
<!-- BLOCK: magic_items, TYPE: magicItems, MAX: 5 -->
<table class="items-table">
<tr>
<th>Gegenstand</th>
<th>Beschreibung</th>
</tr>
{{range .MagicItems}}
<tr>
<td>{{.Name}}&nbsp;</td>
<td>{{.Description}} {{if .Properties}}{{.Properties}}{{end}}</td>
</tr>
{{end}}
</table>
</div>
</div>
</div>
<div class="spell-note">
<strong>* +2 auf EW:Zaubern für Spezialisierung von Magiern</strong>
</div>
</div>
</body>
</html>