From 94fc26838d2f0ca659cde10eb7244794fa64f19a Mon Sep 17 00:00:00 2001 From: Tobias Deiminger Date: Thu, 15 Aug 2024 19:21:35 +0200 Subject: [PATCH] Mark more special HTML in templates as safe There were some occurrences of " " in Python statements within Jinja2 templates. They must be marked as safe, otherwise they would be rendered to literal   by auto escaping. This happened in diff screen for any text nodes, and sections with LEVEL: None, as well as in TOCs for sections with LEVEL: None. Relates to #1920. --- .../export/html/templates/screens/document/_shared/toc.jinja | 4 ++-- .../export/html/templates/screens/document/pdf/toc.jinja | 2 +- .../export/html/templates/screens/git/node/requirement.jinja | 2 +- .../export/html/templates/screens/git/node/section.jinja | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/strictdoc/export/html/templates/screens/document/_shared/toc.jinja b/strictdoc/export/html/templates/screens/document/_shared/toc.jinja index aa620882e..2c9e9e57d 100644 --- a/strictdoc/export/html/templates/screens/document/_shared/toc.jinja +++ b/strictdoc/export/html/templates/screens/document/_shared/toc.jinja @@ -33,7 +33,7 @@ data-turbo="false" > - {{ section.context.title_number_string if section.context.title_number_string else " " * (section.ng_level * 2 - 1) }} + {{ section.context.title_number_string if section.context.title_number_string else " "|safe * (section.ng_level * 2 - 1) }} {{- section.title -}} {# TODO #fragment #} {# {{ section.document_is_included() }} {{ section.parent_or_including_document.reserved_title }}/{{ section.get_document().reserved_title }} #} @@ -47,7 +47,7 @@ data-turbo="false" > - {{ section.context.title_number_string if section.context.title_number_string else " " * (section.ng_level * 2 - 1) }} + {{ section.context.title_number_string if section.context.title_number_string else " "|safe * (section.ng_level * 2 - 1) }} {%- if section.reserved_title is not none -%} {{- section.reserved_title -}} diff --git a/strictdoc/export/html/templates/screens/document/pdf/toc.jinja b/strictdoc/export/html/templates/screens/document/pdf/toc.jinja index 70f2d3c2c..65406a8a6 100644 --- a/strictdoc/export/html/templates/screens/document/pdf/toc.jinja +++ b/strictdoc/export/html/templates/screens/document/pdf/toc.jinja @@ -10,7 +10,7 @@
- {{ item.context.title_number_string if item.context.title_number_string else " " * (item.ng_level * 2 - 1) }} + {{ item.context.title_number_string if item.context.title_number_string else " "|safe * (item.ng_level * 2 - 1) }} diff --git a/strictdoc/export/html/templates/screens/git/node/requirement.jinja b/strictdoc/export/html/templates/screens/git/node/requirement.jinja index 7b07352e4..cd14e46bf 100644 --- a/strictdoc/export/html/templates/screens/git/node/requirement.jinja +++ b/strictdoc/export/html/templates/screens/git/node/requirement.jinja @@ -11,7 +11,7 @@ {%- include "components/badge/index.jinja" -%} {%- endwith -%} - {{ requirement.context.title_number_string if requirement.context.title_number_string else " " * (requirement.ng_level * 2 - 1) }} + {{ requirement.context.title_number_string if requirement.context.title_number_string else " "|safe * (requirement.ng_level * 2 - 1) }} {%- if requirement.reserved_title is not none -%} diff --git a/strictdoc/export/html/templates/screens/git/node/section.jinja b/strictdoc/export/html/templates/screens/git/node/section.jinja index 345305848..df1f8eca4 100644 --- a/strictdoc/export/html/templates/screens/git/node/section.jinja +++ b/strictdoc/export/html/templates/screens/git/node/section.jinja @@ -11,7 +11,7 @@ {%- include "components/badge/index.jinja" -%} {%- endwith -%} - {{ section.context.title_number_string if section.context.title_number_string else " " * (section.ng_level * 2 - 1) }} + {{ section.context.title_number_string if section.context.title_number_string else " "|safe * (section.ng_level * 2 - 1) }} {{ section.title }} {%- if tab == "diff" -%}