Opened 16 years ago

Closed 15 years ago

Last modified 15 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: no UI/UX: no

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 16 years ago.
Fixes title, but removes other markup

Download all attachments as: .zip

Change History (16)

by gkelly, 16 years ago

Attachment: 8885-1.diff added

Fixes title, but removes other markup

comment:2 by gkelly, 16 years ago

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 by arien, 16 years ago

Component: DocumentationDjango Web site
Has patch: set

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

comment:5 by Julien Phalip, 16 years ago

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

comment:6 by Julien Phalip, 16 years ago

Triage Stage: UnreviewedAccepted

comment:7 by Chris Beaven, 16 years ago

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

comment:9 by Ramiro Morales, 16 years ago

#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 by Karen Tracey, 16 years ago

Resolution: duplicate
Status: newclosed

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

comment:11 by Karen Tracey, 16 years ago

Resolution: duplicate
Status: closedreopened

Meant to close the other one, not this one.

comment:12 by anonymous, 15 years ago

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

comment:13 by Chris Beaven, 15 years ago

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 by James Bennett, 15 years ago

Resolution: fixed
Status: reopenedclosed

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

in reply to:  14 comment:15 by Karen Tracey, 15 years ago

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?

Note: See TracTickets for help on using tickets.
Back to Top