Code blocks in the user guide and reference guide cannot be copied and pasted as a whole as they contain >>> and ...:
>>> for foo in bar:
... print(foo)
One approach would be a toggle like numpy uses in their manual.
We actually used to have this. Looks like it stopped working.
Looks like the move over to https stopped this working (diagnosed by enabling insecure scripts in the docs).
The line is at https://github.com/SciTools/iris/blob/master/docs/iris/src/_templates/layout.html#L9. It would take a PR to scitools/iris and a PR to http://github.com/scitools/scitools.org.uk to search and replace http://docs.python.org/2/_static/copybutton.js with https://docs.python.org/2/_static/copybutton.js. Interested in doing it @tv3141 ?
@pelson Yes, I can have a look at this.
Thanks for doing this!
Copybutton is broken in Iris2.2, example
I think I broke this in #3071.
Iris2.2 code blocks:
<div class="highlight-default notranslate">
<div class="highlight">
<pre>
<span></span>
...
Iris2.1 code blocks:
<div class="highlight-python notranslate" style="position: relative;">
<div class="highlight">
<span class="copybutton" title="Hide the prompts and output" style="cursor: pointer; position: absolute; top: 0px; right: 0px; border-color: rgb(204, 204, 204); border-style: solid; border-width: 0.994318px; color: rgb(204, 204, 204); font-family: monospace; padding-left: 0.2em; padding-right: 0.2em;">>>></span>
<pre>
...
@pelson Do you want to reopen this ticket or open a new one?
I've reopened. Are you interested in taking a look at this @tv3141?
This may be worth looking at https://github.com/scipy/scipy-sphinx-theme/pull/6.
I believe the new Read The Docs style documentation has resolved this issue. The sphinx_copybutton extension is used to handle this.
See https://scitools-iris.readthedocs.io/en/latest/installing.html for an example (note the icon on the right of the commands)
Note this documentation url is the latest, this points to master. When there is a release for Iris there will also be a stable release and a tagged release too.
I think we can close this issue now?
@tkknight Awesome, job done, thanks! :+1: