From 0027f5df316892f121bb9f4b5b6b641646273ff0 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 18 Sep 2024 14:54:48 +0200 Subject: add requirements + improve generated reqs.tex --- scripts/reqs2tex.py | 15 ++++++++------- scripts/tex.py | 10 ++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/reqs2tex.py b/scripts/reqs2tex.py index 82b0aae..ff9f3bb 100755 --- a/scripts/reqs2tex.py +++ b/scripts/reqs2tex.py @@ -122,7 +122,7 @@ def fmt_tex(data): out = "" for item in data: out += tex.join( - tex.cmd('subsection', item[KEY.ID]), + tex.cmd('subsection', f"{item[KEY.ID]}: {item[KEY.LABEL]}".upper()), tex.withatletter( tex.cmd('cref@constructprefix', 'requirement', r'\cref@result'), tex.pedef('@currentlabel', item[KEY.ID]), @@ -130,12 +130,13 @@ def fmt_tex(data): tex.pedef('cref@currentlabel', tex.group(['requirement'], [''], [r'\cref@result']) + item[KEY.ID]), ), tex.cmd('label', ['requirement'], label2ref(item[KEY.LABEL])), - tex.cmd('par'), - 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('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 ""), + )), + ) ) return out diff --git a/scripts/tex.py b/scripts/tex.py index e8fc65b..07d275a 100644 --- a/scripts/tex.py +++ b/scripts/tex.py @@ -69,3 +69,13 @@ def explist(*items): out += explist(*item) return out +def sec(level, heading): + level = max(min(3, level), 0) + section = [ + 'section', + 'subsection', + 'subsubsection', + 'paragraph', + ][level] + return cmd(section, heading) + -- cgit v1.2.3