From 93e9017473d7d3f21c3aea0d5b88478846a17fe9 Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Fri, 29 Dec 2023 20:50:56 +0100 Subject: [PATCH] export/html: Diff: display MIDs for requirements, sections, and documents --- .../screens/git/fields/document_fields.jinja | 12 ++++++++++++ .../screens/git/fields/requirement_fields.jinja | 12 ++++++++++++ .../screens/git/fields/section_fields.jinja | 12 ++++++++++++ .../export/html/templates/screens/git/nav_tabs.jinja | 8 ++++++++ .../test.itest | 6 ++++++ .../test.itest | 5 +++++ .../test.itest | 4 ++++ .../test.itest | 3 +++ 8 files changed, 62 insertions(+) diff --git a/strictdoc/export/html/templates/screens/git/fields/document_fields.jinja b/strictdoc/export/html/templates/screens/git/fields/document_fields.jinja index bb651a9da..158116581 100644 --- a/strictdoc/export/html/templates/screens/git/fields/document_fields.jinja +++ b/strictdoc/export/html/templates/screens/git/fields/document_fields.jinja @@ -3,6 +3,18 @@
+{# MID field, if permanent, is always printed as-is. It is never marked as modified. #} +{% if document.mid_permanent %} +
+ {%- with badge_text = "MID" -%} + {%- include "components/badge/index.jinja" -%} + {%- endwith -%} + {{ document.reserved_mid }} +
+{% endif %} + {% if document.reserved_uid is not none %} {% set uid_modified = document.reserved_uid is not none and document_change is not none and document_change.uid_modified %}
+ {%- with badge_text = "MID" -%} + {%- include "components/badge/index.jinja" -%} + {%- endwith -%} + {{ requirement.reserved_mid }} +
+{% endif %} +
{%- for requirement_field_triple_ in requirement.enumerate_all_fields() -%} {%- set is_multiline = requirement_field_triple_[0].field_value_multiline is not none -%} 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 7373a42d6..1b9d98ed8 100644 --- a/strictdoc/export/html/templates/screens/git/fields/section_fields.jinja +++ b/strictdoc/export/html/templates/screens/git/fields/section_fields.jinja @@ -1,4 +1,16 @@
+ {# MID field, if permanent, is always printed as-is. It is never marked as modified. #} + {% if section.mid_permanent %} +
+ {%- with badge_text = "MID" -%} + {%- include "components/badge/index.jinja" -%} + {%- endwith -%} + {{ section.reserved_mid }} +
+ {% endif %} + {# 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 %} diff --git a/strictdoc/export/html/templates/screens/git/nav_tabs.jinja b/strictdoc/export/html/templates/screens/git/nav_tabs.jinja index 05a8c2a16..589ff42a4 100644 --- a/strictdoc/export/html/templates/screens/git/nav_tabs.jinja +++ b/strictdoc/export/html/templates/screens/git/nav_tabs.jinja @@ -2,11 +2,19 @@ diff --git a/tests/integration/commands/diff/01__requirements__from_empty_doc_to_one_requirement/test.itest b/tests/integration/commands/diff/01__requirements__from_empty_doc_to_one_requirement/test.itest index e1d67980f..3ad218fa2 100644 --- a/tests/integration/commands/diff/01__requirements__from_empty_doc_to_one_requirement/test.itest +++ b/tests/integration/commands/diff/01__requirements__from_empty_doc_to_one_requirement/test.itest @@ -2,6 +2,12 @@ RUN: %strictdoc diff %S/lhs %S/rhs --output-dir Output RUN: cat %S/Output/changelog.html | filecheck %s --check-prefix=CHECK-CHANGELOG +NOTE: This ensures that the links are printed for static HTML export, not the web server links. +CHECK-CHANGELOG:href="diff.html" +CHECK-CHANGELOG:href="changelog.html" + +NOTE: Checking all the changes below. + CHECK-CHANGELOG:
Summary of the changes
CHECK-CHANGELOG:
Nodes modified
diff --git a/tests/integration/commands/diff/_mid_match/01__mid_match__requirements__from_requirement_to_requirement_no_uid/test.itest b/tests/integration/commands/diff/_mid_match/01__mid_match__requirements__from_requirement_to_requirement_no_uid/test.itest index 3fab3bbab..9e91f71f4 100644 --- a/tests/integration/commands/diff/_mid_match/01__mid_match__requirements__from_requirement_to_requirement_no_uid/test.itest +++ b/tests/integration/commands/diff/_mid_match/01__mid_match__requirements__from_requirement_to_requirement_no_uid/test.itest @@ -14,5 +14,10 @@ CHECK-CHANGELOG:
No sections were modifie CHECK-CHANGELOG:
Requirements modified
CHECK-CHANGELOG:
1 (1 modified)
+CHECK-CHANGELOG:ABCD0123 CHECK-CHANGELOG:Requirement #1 CHECK-CHANGELOG:System shall do 1. + +CHECK-CHANGELOG:ABCD0123 +CHECK-CHANGELOG:TITLE{{.*}}Modified title +CHECK-CHANGELOG:STATEMENT{{.*}}Modified statement. diff --git a/tests/integration/commands/diff/_mid_match/10__mid_match__sections__from_section_to_section_modify_title/test.itest b/tests/integration/commands/diff/_mid_match/10__mid_match__sections__from_section_to_section_modify_title/test.itest index 0ea42d208..f85a955a2 100644 --- a/tests/integration/commands/diff/_mid_match/10__mid_match__sections__from_section_to_section_modify_title/test.itest +++ b/tests/integration/commands/diff/_mid_match/10__mid_match__sections__from_section_to_section_modify_title/test.itest @@ -15,5 +15,9 @@ CHECK-CHANGELOG:
Requirements modified
No requirements were modified.
NOTE: Ensure that the colored diff is shown for the modified title. + +CHECK-CHANGELOG:ABCD0123 CHECK-CHANGELOG:
Section title
+ +CHECK-CHANGELOG:ABCD0123 CHECK-CHANGELOG:
Modified title
diff --git a/tests/integration/commands/diff/_mid_match/20__mid_match__document__from_document_to_document_changed_path/test.itest b/tests/integration/commands/diff/_mid_match/20__mid_match__document__from_document_to_document_changed_path/test.itest index 9a340d289..ec18e1741 100644 --- a/tests/integration/commands/diff/_mid_match/20__mid_match__document__from_document_to_document_changed_path/test.itest +++ b/tests/integration/commands/diff/_mid_match/20__mid_match__document__from_document_to_document_changed_path/test.itest @@ -14,5 +14,8 @@ CHECK-CHANGELOG:
No sections were modifie CHECK-CHANGELOG:
Requirements modified
CHECK-CHANGELOG:
No requirements were modified.
+CHECK-CHANGELOG:ABCD0123 CHECK-CHANGELOG:span class="lambda_red">Hello world doc + +CHECK-CHANGELOG:ABCD0123 CHECK-CHANGELOG:Modified document title