Title: Copybutton does not hide tracebacks
Type: behavior Stage: resolved
Components: Documentation Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: docs@python, eric.araujo, ezio.melotti, georg.brandl, lehmannro, sandro.tosi
Priority: normal Keywords:

Created on 2011-11-19 17:42 by lehmannro, last changed 2012-01-26 12:41 by ezio.melotti. This issue is now closed.

Messages (5)
msg147962 - (view) Author: Robert Lehmann (lehmannro) * Date: 2011-11-19 17:42
The recently added copybutton.js (r18bbfed9aafa) does not work with the 2.7 docs since they are deployed with JQuery 1.2 (which is shipped with Sphinx 0.6).

Copybutton is an unobtrusive Javascript feature which adds a little button to all doctests that removes the interactive prompts in order to copy the code as-is into Python scripts.  I think that feature could well be ported to Sphinx itself.

In line 44 and 51 of Doc/tools/sphinxext/static/copybutton.js the code uses jQuery.nextUntil(), which is new in JQuery 1.4.  That results in tracebacks being only partially hidden.  Reproduce the error at for example.

The Python 3.2+ documentation is not affected as it is built with Sphinx 1.0, which ships with JQuery 1.4.  JQuery Untils are available as a separate plugin (
msg147987 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-20 12:21
Another way to fix this would be to use Sphinx 1.0 for Python 2.7, but I don’t know what’s the status of that, given the amount of changes needed.
msg151342 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-01-16 08:40
Now 2.7 uses Sphinx 1.0, but I think a full rebuild should be triggered in order to update all the files.
Georg, can you do something about it?
msg151348 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-01-16 10:38
A full rebuild should be done anyway next time the script runs.
msg152002 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-01-26 12:41
This should be fixed now.
Date User Action Args
2012-01-26 12:41:46ezio.melottisetstatus: open -> closed
resolution: fixed
messages: + msg152002

stage: needs patch -> resolved
2012-01-16 10:38:26georg.brandlsetmessages: + msg151348
2012-01-16 08:40:05ezio.melottisetmessages: + msg151342
2011-11-20 12:21:55eric.araujosetnosy: + sandro.tosi, eric.araujo
messages: + msg147987
2011-11-19 18:48:41ezio.melottisetassignee: docs@python -> ezio.melotti
stage: needs patch
nosy: + georg.brandl
2011-11-19 17:42:23lehmannrocreate