diff options
-rw-r--r-- | contributing.md | 4 | ||||
-rw-r--r-- | latexmkrc | 2 | ||||
-rw-r--r-- | meta.tex | 1 | ||||
-rw-r--r-- | plan.tex | 8 | ||||
-rw-r--r-- | projdoc.cls | 11 | ||||
-rw-r--r-- | reqs.toml | 29 | ||||
-rwxr-xr-x | scripts/reqs2tex.py | 62 | ||||
-rw-r--r-- | time.txt | 5 |
8 files changed, 57 insertions, 65 deletions
diff --git a/contributing.md b/contributing.md index c11c834..db58388 100644 --- a/contributing.md +++ b/contributing.md @@ -2,10 +2,6 @@ This document is an extension of the [crêpe engine contribution guidelines][crepe-engine-contrib]. Rules in this document override those in the other document. -# Versioning - -- TODO: discuss w/ group - # Code style - Indent using tabs @@ -2,7 +2,7 @@ use File::Spec::Functions; -$pdflatex = "xelatex --interaction=nonstopmode %O %S"; +$pdflatex = "xelatex --interaction=nonstopmode --shell-escape %O %S"; $pdf_mode = 1; $dvi_mode = 0; $postscript_mode = 0; @@ -1,6 +1,5 @@ \organization{Avans University of Applied Sciences} \project{Project cr\^epe} -\version{0.0} \author{% Loek Le Blansch\and% Wouter Boerenkamps\and% @@ -1,15 +1,7 @@ \documentclass{projdoc} \input{meta.tex} -% @Jaro: Zie hieronder -% Version 0.0 seems not right -% I'm also missing a 'version table' -% Shall we use this version system?: -% Version numbers after the comma indicate an interim version and version numbers -% before the comma indicate versions ready for publication - \title{Project Plan} -\version{0.1} \begin{document} \tablestables diff --git a/projdoc.cls b/projdoc.cls index 43fd15c..16b1790 100644 --- a/projdoc.cls +++ b/projdoc.cls @@ -164,8 +164,6 @@ \def\project#1{\def\@project{#1}} \let\@organization\relax \def\organization#1{\def\@organization{#1}} -\let\@version\relax -\def\version#1{\def\@version{#1}} \def\@maketitle{% \centering% \parskip=0pt% @@ -195,8 +193,15 @@ }% \vfill\flushright% \par{% - \par{\strut{}Version \@version\strut}% \par{\strut\@date\strut}% + \begingroup% + \endlinechar=\m@ne\everyeof{\noexpand}% + \edef\x{% + \endgroup% + \def\noexpand\commit{\@@input|"git rev-parse --short HEAD" }% + }% + \x% + \par{\strut\footnotesize({\ttfamily\commit})\strut}% }% \par\vspace*{2in}% } @@ -1,15 +1,10 @@ # This is a TOML file containing all project requirements. The reqs2tex script # can be used to generate the files necessary to compile requirements.tex and # cross-reference the requirements from other documents. -# -# Note that TOML has a hash table structure, so keys used for defining -# requirement properties cannot be used for requirement IDs. The properties are: -# label, type, id, index, deleted, done, description, priority # This is the requirement cross-reference ID. Requirements can be -# (cross-)referenced from LaTeX by prefixing this ID with `req:` and -# substituting dots for colons (i.e. this requirement is referenced as -# \cref{req:audio:async-api}). +# (cross-)referenced from LaTeX by prefixing this ID with `req:` (i.e. this +# requirement is referenced as \cref{req:audio}). [audio] # Requirement type ('system' | 'user') type = 'user' @@ -25,10 +20,10 @@ background music, while simultaniously playing sound effects. # is a list of strings, each item is treated as the ID of another requirement, # and the references are checked before LaTeX runs. done = [ - 'audio.async-api', - 'audio.handle', - 'audio.stream-mix', - 'audio.volume', + 'audio:async-api', + 'audio:handle', + 'audio:stream-mix', + 'audio:volume', ] #done = 'When I feel like it' # Requirements that are no longer applicable should set `deleted` to `true`. @@ -36,7 +31,7 @@ done = [ # different document revisions. #deleted = true -[audio.async-api] +[audio:async-api] type = 'system' priority = 'must' description = ''' @@ -44,7 +39,7 @@ The public audio \gls{api} supports starting audio samples asynchronously (i.e.~fire and forget). ''' -[audio.handle] +[audio:handle] type = 'system' priority = 'must' description = ''' @@ -52,14 +47,14 @@ The public audio \gls{api} allows the game programmer to control (i.e.~play, pause, resume and stop) audio samples after they are created/initialized. ''' -[audio.stream-mix] +[audio:stream-mix] type = 'system' priority = 'must' description = ''' The audio system supports playing multiple audio streams simultaniously. ''' -[audio.volume] +[audio:volume] type = 'system' priority = 'must' description = ''' @@ -69,7 +64,7 @@ audio samples. # TODO: audio encoding support? -[lib.license] +[lib:license] type = 'system' priority = 'must' description = ''' @@ -77,7 +72,7 @@ External libraries must have a license that is MIT-compatible, or one that allows linking against MIT code. ''' -[lib.platform] +[lib:platform] type = 'system' priority = 'must' description = ''' diff --git a/scripts/reqs2tex.py b/scripts/reqs2tex.py index 6984466..0a43acf 100755 --- a/scripts/reqs2tex.py +++ b/scripts/reqs2tex.py @@ -1,9 +1,9 @@ #!/bin/python3 -import sys, tomllib, tex +import sys, tomllib, tex, re from enum import StrEnum def label2ref(*labels): - return ",".join(["req:" + label.replace('.', ':') for label in labels]) + return ",".join(["req:" + label for label in labels]) class KEY(StrEnum): LABEL = 'label' @@ -25,27 +25,6 @@ class REQ_PRIORITY(StrEnum): COULD = 'could' WONT = 'will not' -def flatten(data): - out = [] - for key, value in data.items(): - # this item is a requirement - if key == KEY.DESCRIPTION: - out.append(data) - - # skip over reserved keys - if key in KEY: continue - - # recursively flatten other requirements - items = flatten(value) - # and prefix them with the current key - for item in items: - if KEY.LABEL in item: - item[KEY.LABEL] = f"{key}.{item[KEY.LABEL]}" - else: - item[KEY.LABEL] = f"{key}" - out += items - return out - id_counter = 0 def make_id(item): global id_counter @@ -79,8 +58,7 @@ def sanitize(item, ids): die("definition of done includes unknown requirement(s)") item[KEY.DONE] = tex.cmd('Cref', label2ref(*item[KEY.DONE])) -def convert(data): - reqs = flatten(data) +def convert(reqs): all_ids = [item[KEY.LABEL] for item in reqs] index = 0 for item in reqs: @@ -148,20 +126,42 @@ def fmt_tex(data): ) return out +def tomlload(content): + # replace requirement labels with temp value + label_map = dict() + label_idx = 0 + lines = content.split("\n") + for index, line in enumerate(lines): + match = re.search(r"^\s*\[(.+)\]", line) + if match is None: continue + lines[index] = f"[{label_idx}]" + label_map[str(label_idx)] = match.group(1) + label_idx += 1 + content = "\n".join(lines) + + # load TOML and replace temporary labels with real labels + data_dict = tomllib.loads(content) + data_list = [] + for key, value in data_dict.items(): + value[KEY.LABEL] = label_map[key] + data_list.append(value) + + return data_list + def main(input_file): - data = {} - with open(input_file, "rb") as file: - data = tomllib.load(file) + data = [] + with open(input_file, "r") as file: + data = tomlload(file.read()) - requirements = convert(data) + items = convert(data) output_aux = input_file.removesuffix(".toml") + ".aux" with open(output_aux, "w+") as file: - file.write(fmt_aux(requirements)) + file.write(fmt_aux(items)) output_tex = input_file.removesuffix(".toml") + ".tex" with open(output_tex, "w+") as file: - file.write(fmt_tex(requirements)) + file.write(fmt_tex(items)) if __name__ == "__main__": if len(sys.argv) != 2: @@ -34,6 +34,11 @@ loek: 2024-09-17 2h25m docs :: requirements loek: 2024-09-18 2h20m docs :: requirements loek: 2024-09-18 1h50m research :: audio loek: 2024-09-18 1h05m integration :: PR merge +loek: 2024-09-19 30m docs :: requirements +loek: 2024-09-19 15m project meeting +loek: 2024-09-19 1h30m project meeting +loek: 2024-09-19 45m project meeting +loek: 2024-09-19 15m docs :: remove versioning max: 2024-09-02 1h project kickoff max: 2024-09-02 45m first project meeting |