Commit 7508f484 authored by Ole Streicher's avatar Ole Streicher

New upstream version 1.0

parents
1.0 (2018-01-26)
----------------
- Initial standalone version of the theme (formerly packaged as part of astropy-helpers)
Copyright (c) 2014-2018, Astropy Developers
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the Astropy Team nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include *.txt
include *.rst
include *.py
include astropy_sphinx_theme/__init__.py
# Non-python files.
recursive-include astropy_sphinx_theme *
# Extraneous files.
global-exclude .DS_Store
global-exclude *.pyc
Metadata-Version: 1.0
Name: astropy-sphinx-theme
Version: 1.0
Summary: The sphinx theme for Astropy and affiliated packages.
Home-page: https://github.com/astropy/astropy-sphinx-theme
Author: The Astropy Developers
Author-email: astropy.team@gmail.com
License: UNKNOWN
Description: Astropy Sphinx Theme(s)
-----------------------
This is the repository for the default Astopy project documentation
theme(s). To use this theme, simply install this package then add the
following line to your documentation's ``conf.py`` file:
.. code:: python
html_theme = 'bootstrap-astropy'
This requires Sphinx 1.6 or later to work properly. For older versions
of Sphinx, you will need to do:
.. code:: python
import astropy_sphinx_theme
html_theme_path = astropy_sphinx_theme.get_html_theme_path()
html_theme = 'bootstrap-astropy'
``bootstrap-astropy`` is the only theme that is currently available, but
the structure of the package allows more themes to be added in future if
needed.
.. image:: https://circleci.com/gh/astropy/astropy-sphinx-theme/tree/master.svg?style=svg
:target: https://circleci.com/gh/astropy/astropy-sphinx-theme/tree/master
Platform: UNKNOWN
Astropy Sphinx Theme(s)
-----------------------
This is the repository for the default Astopy project documentation
theme(s). To use this theme, simply install this package then add the
following line to your documentation's ``conf.py`` file:
.. code:: python
html_theme = 'bootstrap-astropy'
This requires Sphinx 1.6 or later to work properly. For older versions
of Sphinx, you will need to do:
.. code:: python
import astropy_sphinx_theme
html_theme_path = astropy_sphinx_theme.get_html_theme_path()
html_theme = 'bootstrap-astropy'
``bootstrap-astropy`` is the only theme that is currently available, but
the structure of the package allows more themes to be added in future if
needed.
.. image:: https://circleci.com/gh/astropy/astropy-sphinx-theme/tree/master.svg?style=svg
:target: https://circleci.com/gh/astropy/astropy-sphinx-theme/tree/master
Metadata-Version: 1.0
Name: astropy-sphinx-theme
Version: 1.0
Summary: The sphinx theme for Astropy and affiliated packages.
Home-page: https://github.com/astropy/astropy-sphinx-theme
Author: The Astropy Developers
Author-email: astropy.team@gmail.com
License: UNKNOWN
Description: Astropy Sphinx Theme(s)
-----------------------
This is the repository for the default Astopy project documentation
theme(s). To use this theme, simply install this package then add the
following line to your documentation's ``conf.py`` file:
.. code:: python
html_theme = 'bootstrap-astropy'
This requires Sphinx 1.6 or later to work properly. For older versions
of Sphinx, you will need to do:
.. code:: python
import astropy_sphinx_theme
html_theme_path = astropy_sphinx_theme.get_html_theme_path()
html_theme = 'bootstrap-astropy'
``bootstrap-astropy`` is the only theme that is currently available, but
the structure of the package allows more themes to be added in future if
needed.
.. image:: https://circleci.com/gh/astropy/astropy-sphinx-theme/tree/master.svg?style=svg
:target: https://circleci.com/gh/astropy/astropy-sphinx-theme/tree/master
Platform: UNKNOWN
CHANGES.rst
LICENSE.rst
MANIFEST.in
README.rst
setup.py
astropy_sphinx_theme/__init__.py
astropy_sphinx_theme.egg-info/PKG-INFO
astropy_sphinx_theme.egg-info/SOURCES.txt
astropy_sphinx_theme.egg-info/dependency_links.txt
astropy_sphinx_theme.egg-info/entry_points.txt
astropy_sphinx_theme.egg-info/requires.txt
astropy_sphinx_theme.egg-info/top_level.txt
astropy_sphinx_theme/bootstrap-astropy/globaltoc.html
astropy_sphinx_theme/bootstrap-astropy/layout.html
astropy_sphinx_theme/bootstrap-astropy/localtoc.html
astropy_sphinx_theme/bootstrap-astropy/searchbox.html
astropy_sphinx_theme/bootstrap-astropy/theme.conf
astropy_sphinx_theme/bootstrap-astropy/static/astropy_linkout.svg
astropy_sphinx_theme/bootstrap-astropy/static/astropy_linkout_20.png
astropy_sphinx_theme/bootstrap-astropy/static/astropy_logo.ico
astropy_sphinx_theme/bootstrap-astropy/static/astropy_logo.svg
astropy_sphinx_theme/bootstrap-astropy/static/astropy_logo_32.png
astropy_sphinx_theme/bootstrap-astropy/static/bootstrap-astropy.css
astropy_sphinx_theme/bootstrap-astropy/static/copybutton.js
astropy_sphinx_theme/bootstrap-astropy/static/sidebar.js
astropy_sphinx_theme/tests/__init__.py
astropy_sphinx_theme/tests/test_basic.py
\ No newline at end of file
[sphinx.html_themes]
bootstrap-astropy = astropy_sphinx_theme
""" Astropy Sphinx Theme """
import os
__version__ = "1.0"
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirname(__file__))
return [cur_dir]
def setup(app):
app.add_html_theme('bootstrap-astropy', os.path.abspath(os.path.join(os.path.dirname(__file__), 'bootstrap-astropy')))
<h3>Table of Contents</h3>
{{ toctree(maxdepth=-1, titles_only=true) }}
{% extends "basic/layout.html" %}
{# Collapsible sidebar script from default/layout.html in Sphinx #}
{% set script_files = script_files + ['_static/sidebar.js'] %}
{# Add the google webfonts needed for the logo #}
{% block extrahead %}
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600' rel='stylesheet' type='text/css'/>
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
{% endblock %}
{% block header %}
<div class="topbar">
<a class="brand" title="{{ _('Documentation Home') }}" href="{{ pathto(master_doc) }}"><span id="logotext1">{{ theme_logotext1 }}</span><span id="logotext2">{{ theme_logotext2 }}</span><span id="logotext3">{{ theme_logotext3 }}</span></a>
<ul>
<li><a class="homelink" title="Astropy Homepage" href="http://www.astropy.org"></a></li>
<li><a title="{{ _('General Index') }}" href="{{ pathto('genindex') }}">Index</a></li>
<li><a title="{{ _('Module Index') }}" href="{{ pathto('py-modindex') }}">Modules</a></li>
<li>
{% block sidebarsearch %}
{% include "searchbox.html" %}
{% endblock %}
</li>
</ul>
</div>
{% endblock %}
{% block relbar1 %}
<div class="related">
<h3>{{ _('Navigation') }}</h3>
<ul>
{%- if next %}
<li class="right">
<a href="{{ next.link|e }}" title="{{ next.title|striptags|e }}">
next {{ "&raquo;"|safe }}
</a>
</li>
{%- endif %}
{%- if prev %}
<li class="right">
<a href="{{ prev.link|e }}" title="{{ prev.title|striptags|e }}">
{{ "&laquo;"|safe }} previous
</a>
{% if next %}{{ reldelim2 }}{% endif %}
</li>
{%- endif %}
{%- block rootrellink %}
<li>
<a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>
{{ reldelim1 }}
</li>
{%- endblock %}
{%- for parent in parents %}
<li><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li>
{%- endfor %}
{# Don't put the title in the relbar for the first (index) page. #}
{% if prev %}<li>{{ title }}</li>{% endif %}
{%- block relbaritems %} {% endblock %}
</ul>
</div>
{% endblock %}
{# Silence the bottom relbar. #}
{% block relbar2 %}{% endblock %}
{%- block footer %}
<footer class="footer">
<p class="pull-right">
{%- if edit_on_github %}
<a href="{{ edit_on_github }}">{{ edit_on_github_page_message }}</a> &nbsp;
{%- endif %}
{%- if show_source and has_source and sourcename %}
<a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">{{ _('Page Source') }}</a>
{%- endif %} &nbsp;
<a href="#">Back to Top</a></p>
<p>
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}<br/>
{%- else %}
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}<br/>
{%- endif %}
{%- endif %}
{%- if show_sphinx %}
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %} &nbsp;
{%- endif %}
{%- if last_updated %}
{% trans last_updated=last_updated|e %}Last built {{ last_updated }}.{% endtrans %} <br/>
{%- endif %}
</p>
</footer>
{%- endblock %}
{%- if pagename != "search" %}
<form action="{{ pathto('search') }}" method="get">
<input type="text" name="q" placeholder="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
{%- endif %}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
id="svg2"
height="167.52676"
width="771.12372">
<defs
id="defs4">
<linearGradient
id="linearGradient3767">
<stop
style="stop-color:#ffa900;stop-opacity:1;"
offset="0"
id="stop3800" />
<stop
style="stop-color:#fd0000;stop-opacity:1;"
offset="1"
id="stop3775" />
</linearGradient>
</defs>
<g
transform="translate(6.1070519,22.476169)"
id="layer1">
<g
id="text3047"
style="fill:#000000;fill-opacity:1;stroke:none">
<path
id="path4164"
style="fill:#ffffff"
d="m 5.5129443,73.773459 c 0,15.91 11.0999997,26.640001 27.0099997,26.640001 10.73,0 19.98,-5.365001 28.12,-12.210001 l 0.555,0 1.665,9.99 17.39,0 0,-53.835 c 0,-25.345 -11.1,-39.2200004 -33.855,-39.2200004 -14.43,0 -27.195,5.5500004 -37.1849997,11.8400004 l 7.7699997,14.245 c 7.955,-4.81 16.465,-8.88 25.53,-8.88 12.21,0 16.28,8.14 16.465,17.76 -37.185,4.07 -53.4649997,14.245 -53.4649997,33.67 z m 20.7199997,-1.665 c 0,-9.065 8.14,-15.54 32.745,-18.685 l 0,20.35 c -6.66,6.29 -12.395,9.99 -19.795,9.99 -7.585,0 -12.95,-3.515 -12.95,-11.655 z" />
<path
id="path4166"
style="fill:#ffffff"
d="m 97.168882,87.833459 c 8.879998,7.215 22.014998,12.580001 34.409998,12.580001 22.94,0 35.335,-12.580001 35.335,-28.120001 0,-17.02 -13.69,-22.94 -26.085,-27.565 -9.805,-3.515 -18.87,-6.29 -18.87,-13.505 0,-5.735 4.255,-9.99 13.32,-9.99 7.215,0 13.69,3.145 19.98,7.77 l 9.805,-12.95 c -7.4,-5.735 -17.575,-10.9150004 -30.155,-10.9150004 -20.35,0 -33.115,11.2850004 -33.115,27.1950004 0,15.17 13.505,22.015 25.53,26.455 9.62,3.7 19.425,7.03 19.425,14.615 0,6.29 -4.625,10.915 -14.43,10.915 -9.25,0 -17.02,-3.885 -25.16,-10.175 l -9.989998,13.69 z" />
<path
id="path4168"
style="fill:#ffffff"
d="m 189.2324,67.483459 c 0,19.61 7.77,32.930001 28.86,32.930001 7.215,0 13.505,-1.665001 18.5,-3.330001 l -3.7,-15.725 c -2.59,1.11 -6.29,2.035 -9.435,2.035 -8.695,0 -12.765,-5.18 -12.765,-15.91 l 0,-43.29 23.125,0 0,-16.8350004 -23.125,0 0,-24.7899996 -17.76,0 -2.59,24.7899996 -14.06,0.925 0,15.9100004 12.95,0 0,43.29 z" />
<path
id="path4170"
style="fill:#ffffff"
d="m 252.9331,98.193459 21.275,0 0,-55.5 c 5.55,-13.69 14.245,-18.685 21.46,-18.685 3.885,0 6.29,0.555 9.435,1.48 l 3.7,-18.5000004 c -2.775,-1.295 -5.735,-1.85 -10.36,-1.85 -9.62,0 -19.24,6.4750004 -25.715,18.3150004 l -0.74,0 -1.48,-16.0950004 -17.575,0 0,90.8350004 z" />
<path
id="path4172"
style="fill:#ffffff"
d="m 314.22013,52.868459 c 0,30.155 20.535,47.545001 43.105,47.545001 22.755,0 43.29,-17.390001 43.29,-47.545001 0,-30.34 -20.535,-47.7300004 -43.29,-47.7300004 -22.57,0 -43.105,17.3900004 -43.105,47.7300004 z m 21.83,0 c 0,-18.315 7.955,-30.34 21.275,-30.34 13.32,0 21.46,12.025 21.46,30.34 0,18.13 -8.14,30.155 -21.46,30.155 -13.32,0 -21.275,-12.025 -21.275,-30.155 z" />
<path
id="path4174"
style="fill:#ff5000;fill-opacity:1"
d="m 433.32833,89.498459 c 9.25,6.845 18.315,10.915001 26.64,10.915001 20.905,0 39.22,-17.760001 39.22,-47.915001 0,-27.565 -11.84,-45.3250004 -35.52,-45.3250004 -10.915,0 -21.46,6.4750004 -30.155,13.3200004 l -0.555,0 -0.74,-11.1000004 -7.03,0 0,128.9450014 8.14,0 0,-32.375 0,-16.465001 z m 0,-7.77 0,-52.725 c 10.73,-9.435 20.165,-14.615 29.045,-14.615 20.35,0 28.12,16.28 28.12,38.11 0,24.05 -12.95,40.7 -30.895,40.7 -6.845,0 -16.095,-3.145 -26.27,-11.47 z" />
<path
id="path4176"
style="fill:#ff5000;fill-opacity:1"
d="m 515.26888,129.64346 -1.85,7.215 c 2.405,1.11 5.735,1.85 9.065,1.85 15.91,0 24.79,-14.615 29.785,-29.415 l 35.15,-99.9000014 -8.325,0 -19.055,55.8700004 c -2.405,7.4 -5.365,17.02 -8.14,24.79 l -0.74,0 c -3.33,-7.77 -6.845,-17.39 -9.62,-24.79 l -21.46,-55.8700004 -8.88,0 36.445,90.4650004 -2.405,7.770001 c -4.44,13.505 -11.84,23.495 -22.755,23.495 -2.59,0 -5.365,-0.74 -7.215,-1.48 z" />
</g>
<path
id="path3796"
d="m 699.71522,8.7813958 c -71.7644,0 -58.16693,0 -58.16693,0 l 0.18886,86.0270502 0,0 89.32779,0 0.37769,-47.195398"
style="fill:none;stroke:#ffffff;stroke-width:7.42324734;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3798"
d="M 690.16624,51.085891 C 750.77539,-8.008031 750.77539,-8.008031 750.77539,-8.008031"
style="fill:none;stroke:#ffffff;stroke-width:10.39999962;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
id="path3800"
d="M 760.01669,-15.838298 717.15954,-2.7141323 744.40571,24.161702 z"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
id="svg2"
height="220"
width="220">
<defs
id="defs4">
<linearGradient
id="linearGradient3767">
<stop
style="stop-color:#ffa900;stop-opacity:1;"
offset="0"
id="stop3800" />
<stop
style="stop-color:#fd0000;stop-opacity:1;"
offset="1"
id="stop3775" />
</linearGradient>
<linearGradient
spreadMethod="repeat"
gradientUnits="userSpaceOnUse"
y2="298.258"
x2="83.651718"
y1="163.12114"
x1="195.5511"
id="linearGradient3798"
xlink:href="#linearGradient3767" />
</defs>
<g
transform="translate(2.5547457,54.766869)"
id="layer1">
<path
clip-path="none"
mask="none"
transform="matrix(1.0651076,-0.90408718,0.89013474,1.0731629,-250.16148,-67.548145)"
d="m 221.23922,233.12846 a 80.322945,68.372307 0 0 1 -80.32294,68.37231 80.322945,68.372307 0 0 1 -80.32295,-68.37231 80.322945,68.372307 0 0 1 80.32295,-68.3723 80.322945,68.372307 0 0 1 80.32294,68.3723 z"
id="path3837"
style="fill:url(#linearGradient3798);fill-opacity:1;fill-rule:nonzero;stroke:none" />
<path
transform="matrix(-0.71212781,-0.99456325,-0.9777811,0.72852659,474.31246,145.67479)"
d="m 238.396,198.78328 c 32.61949,7.06756 15.40308,37.20961 -8.24653,38.06088 -26.00022,0.93589 -44.08994,-24.61831 -41.97511,-48.94224 2.67817,-30.80329 32.53302,-51.80129 62.38812,-48.26147"
id="path5413"
style="fill:none;stroke:#ffffff;stroke-width:14.33045673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
transform="matrix(1.0512298,0.82294962,-0.97239782,0.94168108,304.90482,-361.44933)"
d="m 144.4518,337.67926 a 22.223356,12.626906 0 0 1 -22.22335,12.62691 22.223356,12.626906 0 0 1 -22.22336,-12.62691 22.223356,12.626906 0 0 1 22.22336,-12.62691 22.223356,12.626906 0 0 1 22.22335,12.62691 z"
id="path3819"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
<path
id="path3853"
d="m 136.88413,-13.10567 13.09858,22.1959915 20.1541,-20.0243955 -25.57713,-10.690029 z"
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:2.36031604;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<g
transform="matrix(0.95039189,0,0,0.93299787,-2.487134,-0.56516029)"
id="g3804">
<path
style="fill:none;stroke:#ffffff;stroke-width:3.72635746;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 142.07904,-24.83606 -2.29208,-13.70422 0.18559,0.452199 0,0"
id="path3855-7" />
<path
style="fill:none;stroke:#ffffff;stroke-width:4.02542162;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 127.81295,-26.11257 15.12343,0.663566 -0.4755,0.06597 0,0"
id="path3855-7-0" />
<path
style="fill:none;stroke:#ffffff;stroke-width:4.06302309;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 150.77669,-18.240009 -9.57586,-7.57806 0.46343,0.302121 0,0"
id="path3855-7-05" />
</g>
<path
id="path3942"
d="m 67.476992,131.73602 c 3.410653,2.96251 14.804165,7.71706 18.766169,12.74152 4.041356,5.12504 3.407665,10.98393 3.371624,14.32634"
style="fill:none;stroke:#ffffff;stroke-width:17.45736313;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
transform="matrix(0.95949998,0.82835015,0.79893463,-0.95307413,-285.3304,56.888018)"
d="m 238.396,198.78328 c 32.61946,7.06755 15.40307,37.20957 -8.24652,38.06085 -26.0002,0.93588 -44.0899,-24.61829 -41.97507,-48.9422 2.70006,-31.05511 32.97695,-52.07076 63.01891,-48.18321 1.11735,0.14459 2.2306,0.32088 3.33799,0.52843"
id="path2987-5"
style="fill:none;stroke:#ffffff;stroke-width:13.93870544;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>
$(document).ready(function() {
/* Add a [>>>] button on the top-right corner of code samples to hide
* the >>> and ... prompts and the output and thus make the code
* copyable. */
var div = $('.highlight-python .highlight,' +
'.highlight-python3 .highlight,' +
'.highlight-default .highlight')
var pre = div.find('pre');
// get the styles from the current theme
pre.parent().parent().css('position', 'relative');
var hide_text = 'Hide the prompts and output';
var show_text = 'Show the prompts and output';
var border_width = pre.css('border-top-width');
var border_style = pre.css('border-top-style');
var border_color = pre.css('border-top-color');
var button_styles = {
'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0',
'border-color': border_color, 'border-style': border_style,
'border-width': border_width, 'color': border_color, 'text-size': '75%',
'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em',
'border-radius': '0 3px 0 0'
}
// create and add the button to all the code blocks that contain >>>
div.each(function(index) {
var jthis = $(this);
if (jthis.find('.gp').length > 0) {
var button = $('<span class="copybutton">&gt;&gt;&gt;</span>');
button.css(button_styles)
button.attr('title', hide_text);
button.data('hidden', 'false');
jthis.prepend(button);
}
// tracebacks (.gt) contain bare text elements that need to be
// wrapped in a span to work with .nextUntil() (see later)
jthis.find('pre:has(.gt)').contents().filter(function() {
return ((this.nodeType == 3) && (this.data.trim().length > 0));
}).wrap('<span>');
});
// define the behavior of the button when it's clicked
$('.copybutton').click(function(e){
e.preventDefault();
var button = $(this);
if (button.data('hidden') === 'false') {
// hide the code output
button.parent().find('.go, .gp, .gt').hide();
button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
button.css('text-decoration', 'line-through');
button.attr('title', show_text);
button.data('hidden', 'true');
} else {
// show the code output
button.parent().find('.go, .gp, .gt').show();
button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
button.css('text-decoration', 'none');
button.attr('title', hide_text);
button.data('hidden', 'false');
}
});
});
/*
* sidebar.js
* ~~~~~~~~~~
*
* This script makes the Sphinx sidebar collapsible.
*
* .sphinxsidebar contains .sphinxsidebarwrapper. This script adds
* in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
* used to collapse and expand the sidebar.
*
* When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
* and the width of the sidebar and the margin-left of the document
* are decreased. When the sidebar is expanded the opposite happens.
* This script saves a per-browser/per-session cookie used to
* remember the position of the sidebar among the pages.
* Once the browser is closed the cookie is deleted and the position
* reset to the default (expanded).
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
$(function() {
// global elements used by the functions.
// the 'sidebarbutton' element is defined as global after its
// creation, in the add_sidebar_button function
var bodywrapper = $('.bodywrapper');
var sidebar = $('.sphinxsidebar');
var sidebarwrapper = $('.sphinxsidebarwrapper');
// for some reason, the document has no sidebar; do not run into errors
if (!sidebar.length) return;
// original margin-left of the bodywrapper and width of the sidebar
// with the sidebar expanded
var bw_margin_expanded = bodywrapper.css('margin-left');
var ssb_width_expanded = sidebar.width();
// margin-left of the bodywrapper and width of the sidebar
// with the sidebar collapsed
var bw_margin_collapsed = 12;
var ssb_width_collapsed = 12;
// custom colors
var dark_color = '#404040';
var light_color = '#505050';
function sidebar_is_collapsed() {
return sidebarwrapper.is(':not(:visible)');
}
function toggle_sidebar() {
if (sidebar_is_collapsed())
expand_sidebar();
else
collapse_sidebar();
}
function collapse_sidebar() {
sidebarwrapper.hide();
sidebar.css('width', ssb_width_collapsed);
bodywrapper.css('margin-left', bw_margin_collapsed);
sidebarbutton.css({
'margin-left': '-1px',
'height': bodywrapper.height(),
'border-radius': '3px'
});
sidebarbutton.find('span').text('»');
sidebarbutton.attr('title', _('Expand sidebar'));
document.cookie = 'sidebar=collapsed';
}
function expand_sidebar() {
bodywrapper.css('margin-left', bw_margin_expanded);
sidebar.css('width', ssb_width_expanded);
sidebarwrapper.show();
sidebarbutton.css({
'margin-left': ssb_width_expanded - 12,
'height': bodywrapper.height(),
'border-radius': '0px 3px 3px 0px'
});
sidebarbutton.find('span').text('«');
sidebarbutton.attr('title', _('Collapse sidebar'));
document.cookie = 'sidebar=expanded';
}
function add_sidebar_button() {
sidebarwrapper.css({
'float': 'left',
'margin-right': '0',
'width': ssb_width_expanded - 18
});
// create the button
sidebar.append('<div id="sidebarbutton"><span>&laquo;</span></div>');
var sidebarbutton = $('#sidebarbutton');
// find the height of the viewport to center the '<<' in the page
var viewport_height;
if (window.innerHeight)
viewport_height = window.innerHeight;
else
viewport_height = $(window).height();
var sidebar_offset = sidebar.offset().top;
var sidebar_height = Math.max(bodywrapper.height(), sidebar.height());
sidebarbutton.find('span').css({
'font-family': '"Lucida Grande",Arial,sans-serif',
'display': 'block',
'top': Math.min(viewport_height/2, sidebar_height/2 + sidebar_offset) - 10,
'width': 12,
'position': 'fixed',
'text-align': 'center'
});
sidebarbutton.click(toggle_sidebar);
sidebarbutton.attr('title', _('Collapse sidebar'));
sidebarbutton.css({
'color': '#FFFFFF',
'background-color': light_color,
'border': '1px solid ' + light_color,
'border-radius': '0px 3px 3px 0px',
'font-size': '1.2em',
'cursor': 'pointer',
'height': sidebar_height,
'padding-top': '1px',
'margin': '-1px',
'margin-left': ssb_width_expanded - 12
});
sidebarbutton.hover(
function () {
$(this).css('background-color', dark_color);
},
function () {
$(this).css('background-color', light_color);
}
);
}
function set_position_from_cookie() {
if (!document.cookie)
return;
var items = document.cookie.split(';');
for(var k=0; k<items.length; k++) {
var key_val = items[k].split('=');
var key = key_val[0];
if (key == 'sidebar') {
var value = key_val[1];
if ((value == 'collapsed') && (!sidebar_is_collapsed()))
collapse_sidebar();
else if ((value == 'expanded') && (sidebar_is_collapsed()))
expand_sidebar();
}
}
}
add_sidebar_button();
var sidebarbutton = $('#sidebarbutton');
set_position_from_cookie();
});