aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-09-16 19:07:50 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-09-16 19:07:50 +0200
commit2e49e0e0db184295eb08e930a3ccdf10e80e40fe (patch)
tree4134da649775f40cdf74004b047b7df50a4428d5 /scripts
parentb31ebef3db3765eef8e0492897e870a9fa4cd32b (diff)
implement simple requirements dump
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/reqs2tex.py32
-rw-r--r--scripts/tex.py8
2 files changed, 26 insertions, 14 deletions
diff --git a/scripts/reqs2tex.py b/scripts/reqs2tex.py
index 667eeb6..3bf0501 100755
--- a/scripts/reqs2tex.py
+++ b/scripts/reqs2tex.py
@@ -68,22 +68,28 @@ def convert(data):
return reqs
-def req2aux(req):
- ref = tex.label2ref(req['label'])
- out = [
- tex.cmd('newlabel', f"{ref}", tex.group(req['id'], req['id'], 'ggg', 'hhh', 'iii')),
- tex.cmd('newlabel', f"{ref}@cref", tex.group(f"[requirement][aaa][bbb]{req['id']}", '[ccc][ddd][eee]fff')),
- ]
- return "\n".join(out)
-
def fmt_aux(data):
- out = "\n".join([req2aux(req) for req in data])
- return out
+ out = []
+ for req in data:
+ ref = tex.label2ref(req['label'])
+ out += [
+ tex.cmd('newlabel', f"{ref}", tex.group(req['id'], req['id'], 'ggg', 'hhh', 'iii')),
+ tex.cmd('newlabel', f"{ref}@cref", tex.group(f"[requirement][aaa][bbb]{req['id']}", '[ccc][ddd][eee]fff')),
+ ]
+ return "\n".join(out)
def fmt_tex(data):
- return "\n".join([
- tex.cmd('relax')
- ])
+ out = []
+ for req in data:
+ out.append(
+ tex.cmd('subsection', req['id']) + "\n\n" +\
+ tex.env('description',
+ tex.cmd('item', ['Priority']) + req['priority'].title() +\
+ tex.cmd('item', ['Requirement']) + req['description'] +\
+ (tex.cmd('item', ['Definition of done']) + req['done'] if req['type'] == 'user' else "")
+ )
+ )
+ return "\n\n".join(out)
def main(input_file):
data = {}
diff --git a/scripts/tex.py b/scripts/tex.py
index 2fd51d8..2509a87 100644
--- a/scripts/tex.py
+++ b/scripts/tex.py
@@ -1,7 +1,13 @@
# utility function for converting latex code
def group(*args):
- return "".join("{" + arg + "}" for arg in args)
+ out = ""
+ for arg in args:
+ if isinstance(arg, list):
+ out += "[" + arg[0] + "]"
+ if isinstance(arg, str):
+ out += "{" + arg + "}"
+ return out
def string(content):
return r"\string" + content