Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark more special HTML in templates as safe #1936

Merged
merged 1 commit into from
Aug 16, 2024
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
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 node, and sections with
LEVEL: None, as well as in TOCs for sections with LEVEL: None.

Relates to #1920.
  • Loading branch information
haxtibal committed Aug 15, 2024
commit a624ff6e3e35dfc77feb7764e1568a1c80b82481
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
data-turbo="false"
>
<span class="section-number">
{{ section.context.title_number_string if section.context.title_number_string else "&nbsp;" * (section.ng_level * 2 - 1) }}
{{ section.context.title_number_string if section.context.title_number_string else "&nbsp;"|safe * (section.ng_level * 2 - 1) }}
</span>{{- section.title -}}
{# TODO #fragment #}
{# {{ section.document_is_included() }} {{ section.parent_or_including_document.reserved_title }}/{{ section.get_document().reserved_title }} #}
Expand All @@ -47,7 +47,7 @@
data-turbo="false"
>
<span class="section-number">
{{ section.context.title_number_string if section.context.title_number_string else "&nbsp;" * (section.ng_level * 2 - 1) }}
{{ section.context.title_number_string if section.context.title_number_string else "&nbsp;"|safe * (section.ng_level * 2 - 1) }}
</span>
{%- if section.reserved_title is not none -%}
{{- section.reserved_title -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="pdf-toc-row" data-nodeid="{{ item.reserved_mid }}">

<span class="pdf-toc-cell">
{{ item.context.title_number_string if item.context.title_number_string else "&nbsp;" * (item.ng_level * 2 - 1) }}
{{ item.context.title_number_string if item.context.title_number_string else "&nbsp;"|safe * (item.ng_level * 2 - 1) }}
</span>
<span dotted class="pdf-toc-cell">
<a href="#{{ view_object.render_local_anchor(item) }}" data-turbo="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{%- include "components/badge/index.jinja" -%}
{%- endwith -%}
<span>
{{ requirement.context.title_number_string if requirement.context.title_number_string else "&nbsp;" * (requirement.ng_level * 2 - 1) }}
{{ requirement.context.title_number_string if requirement.context.title_number_string else "&nbsp;"|safe * (requirement.ng_level * 2 - 1) }}
</span>
{%- if requirement.reserved_title is not none -%}
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{%- include "components/badge/index.jinja" -%}
{%- endwith -%}
<span>
{{ section.context.title_number_string if section.context.title_number_string else "&nbsp;" * (section.ng_level * 2 - 1) }}
{{ section.context.title_number_string if section.context.title_number_string else "&nbsp;"|safe * (section.ng_level * 2 - 1) }}
</span>
<span>{{ section.title }}</span>
{%- if tab == "diff" -%}
Expand Down
Loading