Strip tags from navigation prev, next titles

Per the Sphinx documentations:

  next - The next document for the navigation. This variable is either
  false or has two attributes link and title. The title contains HTML
  markup.

  prev - Like next, but for the previous page.

If using the title value inside an element attribute, we need to ensure
the HTML tags mentioned above are stripped. Failure to do so results in
corrupted output.

Change-Id: I5fde1e6fc4d7966fcd3e767c79535202f3b41a71
Closes-Bug: #1702328
This commit is contained in:
Stephen Finucane 2017-07-04 16:48:49 +01:00
parent cb33fecb2d
commit d727e522b9
3 changed files with 9 additions and 4 deletions

View File

@ -64,10 +64,10 @@ ga('send', 'pageview');
</div>
<div class="docs-actions">
{% if prev %}
<a href="{{ prev.link|e }}"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: {{ prev.title }}"></i></a>
<a href="{{ prev.link|e }}"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: {{ prev.title|striptags }}"></i></a>
{% endif %}
{% if next %}
<a href="{{ next.link|e }}"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: {{ next.title }}"></i></a>
<a href="{{ next.link|e }}"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: {{ next.title|striptags }}"></i></a>
{% endif %}
{%- if bug_project %}
<a id="logABugLink3" href="" target="_blank" title="Found an error? Report a bug against this page"><i class="fa fa-bug" data-toggle="tooltip" data-placement="top" title="Report a Bug"></i></a>

View File

@ -8,10 +8,10 @@
</div>
<div class="docs-actions">
{% if prev %}
<a href="{{ prev.link|e }}"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: {{ prev.title }}"></i></a>
<a href="{{ prev.link|e }}"><i class="fa fa-angle-double-left" data-toggle="tooltip" data-placement="top" title="Previous: {{ prev.title|striptags }}"></i></a>
{% endif %}
{% if next %}
<a href="{{ next.link|e }}"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: {{ next.title }}"></i></a>
<a href="{{ next.link|e }}"><i class="fa fa-angle-double-right" data-toggle="tooltip" data-placement="top" title="Next: {{ next.title|striptags }}"></i></a>
{% endif %}
{%- if bug_project %}
<a id="logABugLink1" href="" target="_blank" title="Found an error? Report a bug against this page"><i class="fa fa-bug" data-toggle="tooltip" data-placement="top" title="Report a Bug"></i></a>

View File

@ -0,0 +1,5 @@
---
fixes:
- |
The navigation links now correctly strip HTML from titles, allowing for
use of markup like literal backticks in titles.