needarch¶
needarch
behaves exactly like needuml, but only works inside a need. It provides also additional exclusive
jinja functions need() and import(need_links_option_name).
Example
.. req:: Requirement arch
:id: req_arch_001
.. needarch::
:scale: 50
:align: center
Alice -> Bob: Hi Bob
Bob --> Alice: hi Alice
Result
|
Jinja context¶
The following Jinja functions are only available for needarch.
need()¶
New in version 1.0.3.
The need() function provides you the need information the needarch is embedded in.
Example
.. req:: Req Arch four
:id: req_arch_004
:status: draft
:blocks: req_arch_001
content.
.. needarch::
:scale: 50
:align: center
class "{{need().title}}" {
{{need().status}}
{% for e in need().blocks %}{{e}}
{% endfor %}
}
Result
content.
|
import(need_links_option_name)¶
This function takes undefined amounts of current need links option names as arguments.
Then it executes uml(id) automatically for all links/need_ids defined from the given arguments.
Example
.. req:: Req Arch second
:id: req_arch_002
content.
.. req:: Req Arch third
:id: req_arch_003
some.
.. test:: Test Arch
:id: test_arch_001
:checks: req_arch_001
:tests: req_arch_002, req_arch_003
Test need arch jinja import function.
.. needarch::
:scale: 50
:align: center
{{import("checks", "tests")}}
Result
arch req content. |
some req stuff. |
some spec content. |
Test need arch jinja import function.
|
NeedArch Loop Example¶
New in version 1.0.3.
NeedArch can detect include loops (uml(‘1’) -> uml(‘2’) -> uml(‘3’) -> uml(‘1’) and can avoid to include an element twice. Maybe this is not always the use case you have, if so please create an issue and mention this chapter. The algorithm does detect different parameter sets and does import uml() calls with different parameter to the same need.
Example
.. comp:: COMP_T_001
:id: COMP_T_001
.. needarch::
{{flow(need().id)}}
{% if variant == "A" %}
{{uml('COMP_T_003', variant="A")}}
usecase {{need().id}}_usecase
{% else %}
{{uml('COMP_T_003')}}
{{uml('COMP_T_003', variant="A")}}
{% endif %}
.. comp:: COMP_T_002
:id: COMP_T_002
.. needarch::
{{flow(need().id)}}
{% if variant == "A" %}
{{uml('COMP_T_001', variant="A")}}
usecase {{need().id}}_usecase
{% else %}
{{uml('COMP_T_001')}}
{% endif %}
.. comp:: COMP_T_003
:id: COMP_T_003
.. needarch::
{{flow(need().id)}}
{% if variant == "A" %}
{{uml('COMP_T_002', variant="A")}}
usecase {{need().id}}_usecase
{% else %}
{{uml('COMP_T_002')}}
{% endif %}
Result
|
|
|