aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glossary.bib5
-rw-r--r--projdoc.cls25
-rw-r--r--requirements.tex12
-rwxr-xr-xscripts/reqs2tex.py32
-rw-r--r--scripts/tex.py8
5 files changed, 57 insertions, 25 deletions
diff --git a/glossary.bib b/glossary.bib
index 4d02e4a..437db86 100644
--- a/glossary.bib
+++ b/glossary.bib
@@ -28,3 +28,8 @@
description = {Graphics library developed by \hbox{Microsoft}},
}
+@acronym{api,
+ short = {API},
+ long = {Application Programming Interface},
+}
+
diff --git a/projdoc.cls b/projdoc.cls
index 8a592e3..fe8c8bc 100644
--- a/projdoc.cls
+++ b/projdoc.cls
@@ -121,16 +121,23 @@
itemsep=\dimexpr\style@itemsep-\style@parsep\relax,
parsep=\style@parsep,
}
-\def\projdoc@setdescriptionstyle{%
+\def\projdoc@description@before{%
\renewcommand\makelabel[1]{%
{\bfseries ##1}:%
}%
}
-\setdescription{
- before={\projdoc@setdescriptionstyle},
- leftmargin=3em,
- labelindent=3ex,
+\newlength\projdoc@description@leftmargin%
+\projdoc@description@leftmargin=3em%
+\newlength\projdoc@description@labelindent%
+\projdoc@description@labelindent=3ex%
+\def\projdoc@setdescriptionstyle{%
+ \setdescription{
+ before={\projdoc@description@before},
+ leftmargin=\projdoc@description@leftmargin,
+ labelindent=\projdoc@description@labelindent,
+ }%
}
+\projdoc@setdescriptionstyle%
\makeatother
% create a label using \customlabel[<creftype>]{<refname>}{<reftext>} that displays
@@ -230,11 +237,9 @@
}{}%
% glossary
\ifbool{projdoc@used@gls}{%
- \setdescription{
- before={\projdoc@setdescriptionstyle},
- leftmargin=2ex,
- labelindent=0pt,
- }%
+ \projdoc@description@leftmargin=2ex%
+ \projdoc@description@labelindent=0pt%
+ \projdoc@setdescriptionstyle%
\section*{Glossary}%
\begin{multicols}{2}%
\renewcommand{\glossarysection}[2][]{}%
diff --git a/requirements.tex b/requirements.tex
index 1b51220..dee529d 100644
--- a/requirements.tex
+++ b/requirements.tex
@@ -1,10 +1,20 @@
\documentclass{projdoc}
\input{meta.tex}
-\input{reqs.tex}
+
+\makeatletter
+\projdoc@description@leftmargin=2ex
+\projdoc@description@labelindent=0pt
+\projdoc@setdescriptionstyle
+\makeatother
\title{Requirements}
\begin{document}
+\section{Requirements}
+\begin{multicols}{2}
+\input{reqs.tex}
+\end{multicols}
+
\end{document}
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