Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion strictdoc/export/html/templates/components/node/readonly.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@

{% set node_type_string = sdoc_entity.get_node_type_string() %}

{#
dev tag: #narrative_meta_hanging

Html2pdf4doc rules for `Narrative` requirement style:
* If no multi-line content:
the node is not split at all (with or without a title)
-> add .html2pdf4doc-no-break to node.
* PROBLEM:
We assume that the number of single-line strings is no greater than the height of the page

FIXME: Review this rules after upgrading html2pdf4doc to 0.2.4+
#}
{% set _user_requirement_style = sdoc_entity.get_requirement_style_mode() %}
{% set _has_multiline_fields = sdoc_entity.has_multiline_fields() %}
{% set _narrative_has_no_multiline_fields = not _has_multiline_fields and _user_requirement_style == 'narrative' %}

<sdoc-node
node-style="readonly"
node-role="{{ sdoc_entity.get_type_string() }}"
{%- if node_type_string is not none %}
show-node-type-name="{{ node_type_string }}"
{%- endif %}
{% if sdoc_entity.is_requirement %}
node-view="{{ sdoc_entity.get_requirement_style_mode() }}"
node-view="{{ _user_requirement_style }}"
{%- endif -%}
{%- if _narrative_has_no_multiline_fields %}
class="html2pdf4doc-no-break"
{%- endif %}
data-testid="node-{{ sdoc_entity.get_type_string() }}"
>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,35 @@
#}
{% set user_requirement_style = sdoc_entity.get_requirement_style_mode() %}

{#
dev tag: #narrative_meta_hanging

Html2pdf4doc rules for `Narrative` requirement style:
* If no title:
“meta” does not hang
-> add .html2pdf4doc-no-hanging to .node_fields_group-secondary.
* If no multi-line content:
the node is not split at all (with or without a title)
-> add .html2pdf4doc-no-break to node.
* PROBLEM:
We assume that the number of single-line strings is no greater than the height of the page

FIXME: Review this rules after upgrading html2pdf4doc to 0.2.4+
#}
{% set _no_title = not sdoc_entity.reserved_title %}
{% set _has_multiline_fields = sdoc_entity.has_multiline_fields() %}
{% set _narrative_has_multiline_fields = _has_multiline_fields and user_requirement_style == 'narrative' %}
{% set _narrative_has_no_multiline_fields = not _has_multiline_fields and user_requirement_style == 'narrative' %}

<sdoc-node-content
node-view="{{ requirement_style|d(sdoc_entity.get_requirement_style_mode()) }}"
data-level="{{ sdoc_entity.context.title_number_string }}"
{%- if sdoc_entity.reserved_status %}
data-status='{{ sdoc_entity.reserved_status.lower() }}'
{%- endif %}
{%- if _narrative_has_no_multiline_fields %}
class="html2pdf4doc-no-break"
{%- endif %}
show-node-type-name="{{ sdoc_entity.get_node_type_string() }}"
data-testid="requirement-style-{{ requirement_style|d(sdoc_entity.get_requirement_style_mode()) }}"
>
Expand All @@ -37,12 +60,12 @@
#}

{% if user_requirement_style == 'narrative' %}
<sdoc-scope class="node_fields_group-secondary html2pdf4doc-no-hanging">
<sdoc-scope class="node_fields_group-secondary{% if _no_title %} html2pdf4doc-no-hanging{% endif %}">
{% include "components/node_field/meta/index.jinja" %}
{% include "components/node_field/links/index.jinja" %}
{% include "components/node_field/files/index.jinja" %}
</sdoc-scope>
{% if sdoc_entity.has_multiline_fields() %}
{% if _narrative_has_multiline_fields %}
<sdoc-scope class="node_fields_group-primary">
{% include "components/node_field/statement/index.jinja" %}
{% include "components/node_field/rationale/index.jinja" %}
Expand Down
Loading