Skip to content

Commit 0f19d9f

Browse files
Update Pandoc PDF template with version metadata support (#39)
* Initial plan * Update Pandoc PDF template and add version/date metadata Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Fix metadata parameter handling in pandoc commands Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Simplify date metadata handling using bash date command Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent 08548d6 commit 0f19d9f

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

.github/workflows/build.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ jobs:
349349
dotnet pandoc
350350
--defaults docs/guide/definition.yaml
351351
--filter node_modules/.bin/mermaid-filter.cmd
352+
--metadata version="${{ inputs.version }}"
353+
--metadata date="$(date +'%Y-%m-%d')"
352354
--output docs/guide/guide.html
353355
354356
- name: Generate Guide PDF with Weasyprint
@@ -363,6 +365,8 @@ jobs:
363365
dotnet pandoc
364366
--defaults docs/quality/definition.yaml
365367
--filter node_modules/.bin/mermaid-filter.cmd
368+
--metadata version="${{ inputs.version }}"
369+
--metadata date="$(date +'%Y-%m-%d')"
366370
--output docs/quality/quality.html
367371
368372
- name: Generate Code Quality PDF with Weasyprint
@@ -377,6 +381,8 @@ jobs:
377381
dotnet pandoc
378382
--defaults docs/requirements/definition.yaml
379383
--filter node_modules/.bin/mermaid-filter.cmd
384+
--metadata version="${{ inputs.version }}"
385+
--metadata date="$(date +'%Y-%m-%d')"
380386
--output docs/requirements/requirements.html
381387
382388
- name: Generate Requirements PDF with Weasyprint
@@ -391,6 +397,8 @@ jobs:
391397
dotnet pandoc
392398
--defaults docs/tracematrix/definition.yaml
393399
--filter node_modules/.bin/mermaid-filter.cmd
400+
--metadata version="${{ inputs.version }}"
401+
--metadata date="$(date +'%Y-%m-%d')"
394402
--output docs/tracematrix/tracematrix.html
395403
396404
- name: Generate Trace Matrix PDF with Weasyprint

docs/template/template.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
margin-bottom: 1rem;
5757
}
5858

59+
.version {
60+
font-size: 1rem;
61+
color: #888;
62+
margin-bottom: 1rem;
63+
font-style: italic;
64+
}
65+
5966
.author, .date {
6067
font-size: 1rem;
6168
color: #888;
@@ -153,7 +160,7 @@
153160
border: 1px solid #ddd;
154161
border-radius: 4px;
155162
padding: 1rem;
156-
overflow-x: auto;
163+
overflow: auto;
157164
margin-bottom: 1rem;
158165
page-break-inside: avoid;
159166
}
@@ -250,26 +257,32 @@
250257
size: letter;
251258
margin: 1in 0.75in;
252259

253-
@top-center {
260+
@top-left {
254261
content: string(doctitle);
255262
font-size: 10pt;
256263
color: #666;
257-
border-bottom: 1px solid #e0e0e0;
258-
padding-bottom: 0.25in;
264+
}
265+
266+
@top-right {
267+
content: string(docversion);
268+
font-size: 10pt;
269+
color: #666;
259270
}
260271

261272
@bottom-center {
262273
content: "Page " counter(page) " of " counter(pages);
263274
font-size: 10pt;
264275
color: #666;
265-
border-top: 1px solid #e0e0e0;
266-
padding-top: 0.25in;
267276
}
268277
}
269278

270279
/* Don't show header/footer on title page */
271280
@page :first {
272-
@top-center {
281+
@top-left {
282+
content: none;
283+
}
284+
285+
@top-right {
273286
content: none;
274287
}
275288

@@ -283,6 +296,11 @@
283296
string-set: doctitle content();
284297
}
285298

299+
/* Set the document version for the header */
300+
.version {
301+
string-set: docversion content();
302+
}
303+
286304
/* Add page numbers to TOC entries using target-counter */
287305
#TOC a::after {
288306
content: leader('.') target-counter(attr(href), page);
@@ -309,6 +327,9 @@ <h1 class="title">$title$</h1>
309327
$if(subtitle)$
310328
<p class="subtitle">$subtitle$</p>
311329
$endif$
330+
$if(version)$
331+
<p class="version">Version $version$</p>
332+
$endif$
312333
$for(author)$
313334
<p class="author">$author$</p>
314335
$endfor$

0 commit comments

Comments
 (0)