From 0027f5df316892f121bb9f4b5b6b641646273ff0 Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Wed, 18 Sep 2024 14:54:48 +0200
Subject: add requirements + improve generated reqs.tex

---
 requirements.tex | 1 +
 1 file changed, 1 insertion(+)

(limited to 'requirements.tex')

diff --git a/requirements.tex b/requirements.tex
index 2936272..cbaba81 100644
--- a/requirements.tex
+++ b/requirements.tex
@@ -6,6 +6,7 @@
 \projdoc@description@labelindent=0pt
 \projdoc@setdescriptionstyle
 \makeatother
+\setcounter{secnumdepth}{1}
 
 \title{Requirements}
 
-- 
cgit v1.2.3


From abab5051391b7f8a212539400433eb1db0bb4f06 Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Wed, 18 Sep 2024 15:06:45 +0200
Subject: abbreviate requirement field labels after first occurrence on every
 page

---
 glossary.bib        | 13 +++++++++++++
 requirements.tex    | 21 +++++++++++++++++++++
 scripts/reqs2tex.py | 11 ++++++++---
 3 files changed, 42 insertions(+), 3 deletions(-)

(limited to 'requirements.tex')

diff --git a/glossary.bib b/glossary.bib
index 437db86..8bf48ac 100644
--- a/glossary.bib
+++ b/glossary.bib
@@ -33,3 +33,16 @@
 	long = {Application Programming Interface},
 }
 
+@acronym{reqlabel-priority,
+	short = {pri},
+	long = {priority},
+}
+@acronym{reqlabel-description,
+	short = {req},
+	long = {requirement},
+}
+@acronym{reqlabel-done,
+	short = {DoD},
+	long = {definition of done},
+}
+
diff --git a/requirements.tex b/requirements.tex
index cbaba81..78496e8 100644
--- a/requirements.tex
+++ b/requirements.tex
@@ -8,6 +8,27 @@
 \makeatother
 \setcounter{secnumdepth}{1}
 
+\usepackage{bophook}
+\makeatletter
+\def\reqlabel#1{\csuse{reqlabel@#1}}
+\def\reqlabelreset{%
+	\global\def\reqlabel@priority{%
+		\Glsdesc{reqlabel-priority}%
+		\global\def\reqlabel@priority{\Glstext{reqlabel-priority}}%
+	}%
+	\global\def\reqlabel@description{%
+		\Glsdesc{reqlabel-description}%
+		\global\def\reqlabel@description{\Glstext{reqlabel-description}}%
+	}%
+	\global\def\reqlabel@done{%
+		\Glsdesc{reqlabel-done}%
+		\global\def\reqlabel@done{\Glstext{reqlabel-done}}%
+	}%
+}
+% Abbreviate requirement field labels after first occurrence on every page
+\AtBeginPage{\reqlabelreset}
+\makeatother
+
 \title{Requirements}
 
 \begin{document}
diff --git a/scripts/reqs2tex.py b/scripts/reqs2tex.py
index ff9f3bb..e5f063d 100755
--- a/scripts/reqs2tex.py
+++ b/scripts/reqs2tex.py
@@ -132,9 +132,14 @@ def fmt_tex(data):
       tex.cmd('label', ['requirement'], label2ref(item[KEY.LABEL])),
       tex.cmd('parbox', tex.cmd('linewidth'),
         tex.env('description', tex.join(
-          tex.cmd('item', ['Priority']) + item[KEY.PRIORITY].title(),
-          tex.cmd('item', ['Requirement']) + item[KEY.DESCRIPTION],
-          (tex.cmd('item', ['Definition of done']) + item[KEY.DONE] if item[KEY.DONE] is not None else ""),
+          tex.cmd('item', [tex.cmd('reqlabel', 'priority')]),
+          item[KEY.PRIORITY].title(),
+          tex.cmd('item', [tex.cmd('reqlabel', 'description')]),
+          item[KEY.DESCRIPTION],
+          *([
+            tex.cmd('item', [tex.cmd('reqlabel', 'done')]),
+            item[KEY.DONE]
+          ] if item[KEY.DONE] is not None else []),
         )),
       )
     )
-- 
cgit v1.2.3

