From a152e422a386ad9e82cc9388a594ae547fecf148 Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Fri, 19 Sep 2025 21:07:01 +0200 Subject: [PATCH] specification template added --- __template_specification__.py | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 __template_specification__.py diff --git a/__template_specification__.py b/__template_specification__.py new file mode 100755 index 0000000..41120b3 --- /dev/null +++ b/__template_specification__.py @@ -0,0 +1,43 @@ +import jinja2 +import optparse +import os +import rspec + + +req_spec = rspec.rspec() +req_spec.add_title("Module ") + +# +# Section +# +sec_uuid = req_spec.add( + itemtype=rspec.ITYPE_SEC, + id=1, + heading="Section heading", +) + +# Requirement +req_spec.add( + parent=sec_uuid, + itemtype=rspec.ITYPE_REQ, + id=1, + heading="Requirement heading", + description="A meaningfull description.", + reason="A meaningfull reson for the requirement.", + fitcriterion="A meaningfull and exact fitcriterion.", +) + + +if __name__ == '__main__': + BASEPATH = os.path.abspath(os.path.dirname(__file__)) + parser = optparse.OptionParser("usage: %prog specification_file") + parser.add_option("-t", "--template", dest="template", default=os.path.join(BASEPATH, + 'rspec', 'templates', 'tex', 'requirement_specification.tex'), help="path to the template") + (options, args) = parser.parse_args() + + # render + template_path = os.path.abspath(options.template) + jenv = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(template_path))) + template = jenv.get_template(os.path.basename(template_path)) + print(template.render(data=req_spec)) +