From 59090a33af0e54251e8011ff7b1940ed775c9ff3 Mon Sep 17 00:00:00 2001 From: Maryna Balioura Date: Sun, 24 Dec 2023 19:32:45 +0100 Subject: [PATCH 1/3] export/html: DIFF: updating the document fields markup Closes #1499 --- strictdoc/export/html/_static/diff.css | 13 +-------- .../screens/git/changelog_content.jinja | 4 +-- .../templates/screens/git/diff_content.jinja | 2 +- ...t_abstract.jinja => document_fields.jinja} | 28 +++++++++---------- .../screens/git/fields/section_fields.jinja | 11 +++++--- 5 files changed, 25 insertions(+), 33 deletions(-) rename strictdoc/export/html/templates/screens/git/fields/{document_abstract.jinja => document_fields.jinja} (83%) diff --git a/strictdoc/export/html/_static/diff.css b/strictdoc/export/html/_static/diff.css index fa0fd0775..2708c7f30 100644 --- a/strictdoc/export/html/_static/diff.css +++ b/strictdoc/export/html/_static/diff.css @@ -220,22 +220,11 @@ .diff_node_fields { display: flex; flex-direction: column; - /* row-gap: var(--base-rhythm); */ - - /* in node and in doc as Abstract: */ - padding-top: var(--base-rhythm); + margin: var(--base-rhythm) 0; } .diff_node > .diff_node_fields { - /* in node only: */ - margin-bottom: calc(var(--base-rhythm)*2); padding-left: calc(var(--base-rhythm)*2); - - /* padding-left: calc(var(--base-rhythm)*1.5); - border-left: 1px dotted; */ - - /* border-left: var(--base-rhythm) solid rgba(0,0,0,0.01); - padding-left: calc(var(--base-rhythm)*1); */ } .diff_node_field { diff --git a/strictdoc/export/html/templates/screens/git/changelog_content.jinja b/strictdoc/export/html/templates/screens/git/changelog_content.jinja index 89f3282b7..37d140185 100644 --- a/strictdoc/export/html/templates/screens/git/changelog_content.jinja +++ b/strictdoc/export/html/templates/screens/git/changelog_content.jinja @@ -76,7 +76,7 @@ {% elif change.change_type == "Document modified" %} {% if change.lhs_document is not none %} {% with document=change.lhs_document, side="left", self_stats=change_container.lhs_stats, other_stats=change_container.rhs_stats, traceability_index=change_container.traceability_index_lhs %} - {% include "screens/git/fields/document_abstract.jinja" %} + {% include "screens/git/fields/document_fields.jinja" %} {% endwith %} {% else %}
@@ -101,7 +101,7 @@ {% elif change.change_type == "Document modified" %} {% if change.rhs_document is not none %} {% with document=change.rhs_document, side="right", self_stats=change_container.rhs_stats, other_stats=change_container.lhs_stats, traceability_index=change_container.traceability_index_rhs %} - {% include "screens/git/fields/document_abstract.jinja" %} + {% include "screens/git/fields/document_fields.jinja" %} {% endwith %} {% else %}
diff --git a/strictdoc/export/html/templates/screens/git/diff_content.jinja b/strictdoc/export/html/templates/screens/git/diff_content.jinja index 82597fa37..7662e7c11 100644 --- a/strictdoc/export/html/templates/screens/git/diff_content.jinja +++ b/strictdoc/export/html/templates/screens/git/diff_content.jinja @@ -30,7 +30,7 @@ {{ document.title }} - {% include "screens/git/fields/document_abstract.jinja" %} + {% include "screens/git/fields/document_fields.jinja" %} {%- set document_iterator = traceability_index.get_document_iterator(document) -%} {%- for section_or_requirement in document_iterator.all_content() %} diff --git a/strictdoc/export/html/templates/screens/git/fields/document_abstract.jinja b/strictdoc/export/html/templates/screens/git/fields/document_fields.jinja similarity index 83% rename from strictdoc/export/html/templates/screens/git/fields/document_abstract.jinja rename to strictdoc/export/html/templates/screens/git/fields/document_fields.jinja index 3e7e28d6e..8e71723f5 100644 --- a/strictdoc/export/html/templates/screens/git/fields/document_abstract.jinja +++ b/strictdoc/export/html/templates/screens/git/fields/document_fields.jinja @@ -3,35 +3,36 @@
-{% if document.reserved_uid is not none and document_change is not none and document_change.uid_modified %} -
- {%- with badge_text = "uid" -%} {%- include "components/badge/index.jinja" -%} {%- endwith -%} - {% assert document.reserved_uid is not none %}
{{ document.reserved_uid }}
-
+
{% endif %} {% set title_modified = document_change is not none and document_change.title_modified %} -
- {%- with badge_text = "title" -%} {%- include "components/badge/index.jinja" -%} {%- endwith -%} -
-
+ {% if node.free_texts|length > 0 %} {% set free_text = node.free_texts[0] %} {% set free_text_modified = document_change is not none and document_change.free_text_modified %} -
- - {%- with badge_text = "abstract" -%} + {%- with badge_text = "free text" -%} {%- include "components/badge/index.jinja" -%} {%- endwith -%} -
-
+ {% endif %} diff --git a/strictdoc/export/html/templates/screens/git/fields/section_fields.jinja b/strictdoc/export/html/templates/screens/git/fields/section_fields.jinja index 78c859373..09fd6aa5a 100644 --- a/strictdoc/export/html/templates/screens/git/fields/section_fields.jinja +++ b/strictdoc/export/html/templates/screens/git/fields/section_fields.jinja @@ -1,9 +1,10 @@
{# UID #} {%- if section.reserved_uid is not none and section.reserved_uid|length > 0 -%} + {% set uid_modified = section_change is not none and section_change.uid_modified %}
@@ -15,16 +16,17 @@ {%- endif %} {# TITLE #} + {% set title_modified = section_change is not none and section_change.title_modified %}
{%- with badge_text = "TITLE" -%} {%- include "components/badge/index.jinja" -%} {%- endwith -%} - {% if section_change is not none and section_change.title_modified %} + {% if title_modified %} {%- if section_change.is_paired_change() -%}
{{ section_change.get_colored_title_diff(side) }}
{%- else -%} @@ -38,9 +40,10 @@ {# Free text #} {% if section.free_texts|length > 0 %} {% set free_text = section.free_texts[0] %} + {% set free_text_modified = section_change is none or section_change.free_text_modified %}
From e9bcd7b7b81ae580e6ff9158aff3d82f60ad09b9 Mon Sep 17 00:00:00 2001 From: Maryna Balioura Date: Sun, 24 Dec 2023 20:28:12 +0100 Subject: [PATCH 2/3] export/html: Static HTML export: fix the appearance of interactive features --- .../export/html/templates/components/field/index.jinja | 2 +- .../export/html/templates/components/node/index.jinja | 8 +++++--- .../export/html/templates/components/node/root.jinja | 8 +++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/strictdoc/export/html/templates/components/field/index.jinja b/strictdoc/export/html/templates/components/field/index.jinja index a6271eab5..f4b9e0f72 100644 --- a/strictdoc/export/html/templates/components/field/index.jinja +++ b/strictdoc/export/html/templates/components/field/index.jinja @@ -12,7 +12,7 @@ ! Enabling this option for PDF is highly not recommended. #} -{%- if copy_to_clipboard is defined -%} +{%- if copy_to_clipboard is defined and project_config.is_running_on_server and not standalone -%} {{ field_content }} diff --git a/strictdoc/export/html/templates/components/node/index.jinja b/strictdoc/export/html/templates/components/node/index.jinja index c14b424cb..686ec0890 100644 --- a/strictdoc/export/html/templates/components/node/index.jinja +++ b/strictdoc/export/html/templates/components/node/index.jinja @@ -12,14 +12,16 @@ in the extending template. #} +{% set is_not_standalone = project_config.is_running_on_server and not standalone %} + Date: Sun, 24 Dec 2023 21:35:53 +0100 Subject: [PATCH 3/3] main_router: fix one Jinja template after the standalone condition --- strictdoc/server/routers/main_router.py | 1 + 1 file changed, 1 insertion(+) diff --git a/strictdoc/server/routers/main_router.py b/strictdoc/server/routers/main_router.py index d65c77c06..3744a0f66 100644 --- a/strictdoc/server/routers/main_router.py +++ b/strictdoc/server/routers/main_router.py @@ -1253,6 +1253,7 @@ def cancel_edit_requirement(requirement_mid: str): link_renderer=link_renderer, traceability_index=export_action.traceability_index, project_config=project_config, + standalone=False, ) return HTMLResponse( content=output,