ubconnect render ¶
render
uses a Jinja2-Template and combines it with data from a
needs.json
file to generate a new output file,
which can be a rst-file, a html-report, custom xml, whatever.
ubconnect
render
options ¶
ubconnect
render
-j
needs.json
-t
my_template.rst
-o
output.rst
-j / –json ¶
Defines a relative file to a json file, which can be a
needs.json
file.
Default:
needs.json
in the current working directory
-t / –template ¶
Relative path to a jinja2 template file.
If it is not set, an internal template is used to provide a fast way to test it. See Default template for details.
Default: ubConnect internal template
-o / –output ¶
Relative path to an output file, which gets overwritten, if it already exists.
Default:
needs.rst
in the current working directory
Own template file ¶
The template uses Jinja as template language.
The complete data from the loaded json file is available under the name
data
.
Example for getting the project name of a loaded
needs.json
use
{{
data.project}}
.
Also
{{
now
}}
can be used to get the current datetime.
For some ideas of how a report template may look like, please take a look into our Default template . ubconnect_integrator
Default template ¶
{{ data.project }}
{{ "=" * data.project|length }}
| Report created: {{now}}
| Data exported: {{data.created}}
| Versions found: {{data.versions|length}}
| Current version: {{data.current_version}}
**Versions**:
.. contents::
:local:
{% for name, version in data.versions.items() %}
{{ name }}
{{ "-" * name|length }}
| Needs: {{ version.needs|length }}
| Created: {{ version.created }}
Needs
~~~~~
{% for id, need in version.needs.items() %}
.. {{ need.type }}:: {{ need.title }}
:id: {{ need.id }}
:status: {{ need.status }}
{{ need.description|replace('\n', '\n ') }}
{% endfor %}
{% endfor %}
Result Example
ubConnect
=======================
| Report created: 2021-10-21 11:33:44.107829
| Data exported: 2021-10-21T11:31:06.176901
| Versions found: 1
| Current version: 1.0.0
**Versions**:
.. contents::
:local:
1.0.0
-----
| Needs: 2
| Created: 2021-10-21T11:31:06.176874
Needs
~~~~~
.. spec:: Built in GPS-System
:id: CB_1018
:status: Draft
Codebeamer Link to Issue 1018 ``<http://127.0.0.1:8080/issue/1018>``
Example content
.. spec:: Navigation system
:id: CB_1091
:status: Draft
Codebeamer Link to Issue 1091 ``<http://127.0.0.1:8080/issue/1091>``
Example content