Code

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#8885 closed (fixed)

HTML markup appearing in title of doc page

Reported by: gkelly Owned by: nobody
Component: *.djangoproject.com Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

The page at http://docs.djangoproject.com/en/dev/ref/models/options/ has HTML markup appearing in the title for the page. I haven't seen this with other pages, but it's possible this isn't the only affected URL.

Attachments (1)

8885-1.diff (785 bytes) - added by gkelly 6 years ago.
Fixes title, but removes other markup

Download all attachments as: .zip

Change History (16)

comment:1 Changed 6 years ago by gkelly

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Changed 6 years ago by gkelly

Fixes title, but removes other markup

comment:2 Changed 6 years ago by gkelly

Please ignore patch, a better solution would be to use a template filter to strip the HTML from the title, such as

Index: djangodocs/templates/docs/doc.html
===================================================================
--- djangodocs/templates/docs/doc.html	(revision 8965)
+++ djangodocs/templates/docs/doc.html	(working copy)
@@ -1,6 +1,6 @@
 {% extends "base_docs.html" %}
 
-{% block title %}{{ doc.title }} | Django Documentation{% endblock %}
+{% block title %}{{ doc.title|striptags }} | Django Documentation{% endblock %}
 
 {% block extrahead %}
   {{ block.super }}

comment:3 Changed 6 years ago by arien

  • Component changed from Documentation to Django Web site
  • Has patch set

Changing component; locally generated HTML (make html) doesn't have this problem.

comment:5 Changed 6 years ago by julien

http://docs.djangoproject.com/en/dev/ref/contrib/comments/ also suffers from this strange disease :)

comment:6 Changed 6 years ago by julien

  • Triage Stage changed from Unreviewed to Accepted

comment:7 Changed 6 years ago by SmileyChris

See also for another semi-related problem: #9517 (titles show up escaped in Browse section of the sidebar)

comment:9 Changed 6 years ago by ramiro

#9647 was also a duplicate, and it suggested:

Maybe a |safe filter is needed to be appended to the title tag to allow these characters to be unescaped? 

comment:10 Changed 5 years ago by kmtracey

  • Resolution set to duplicate
  • Status changed from new to closed

#10495 reported this again and also suggested a striptags filter on the title tag.

comment:11 Changed 5 years ago by kmtracey

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Meant to close the other one, not this one.

comment:12 Changed 5 years ago by anonymous

This is still occurring, nearly 11 months after first being opened :)

comment:13 Changed 5 years ago by SmileyChris

  • Patch needs improvement set

#11839 suggests striptags filter too, and has a patch. Modifying documentation to work around the current problem isn't the solution, so I'm marking the patch here as "needs improvement".

comment:14 follow-up: Changed 5 years ago by ubernostrum

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [11598]) Fixed #8885 and its many duplicates (hopefully) by stripping HTML (which implies mark_safe) to titles of documentation pages.

comment:15 in reply to: ↑ 14 Changed 5 years ago by kmtracey

Replying to ubernostrum:

(In [11598]) Fixed #8885 and its many duplicates (hopefully) by stripping HTML (which implies mark_safe) to titles of documentation pages.

striptags has is_safe=True but that won't explicitly mark the output as safe, it will just preserve the safe status of input. We don't mark the title as safe, so it is still being escaped, which means titles with smart quotes, such as:

http://docs.djangoproject.com/en/dev/ref/contrib/sites/
http://docs.djangoproject.com/en/dev/ref/contrib/comments/
http://docs.djangoproject.com/en/dev/internals/release-process/
http://docs.djangoproject.com/en/dev/topics/cache/

are still looking a bit odd. Could we also just explicitly run doc.title through the safe filter?

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.