Home | History | Annotate | Download | only in templates
      1 {% extends "!layout.html" %}
      2 {% block rootrellink %}
      3         <li><img src="{{ pathto('_static/py.png', 1) }}" alt=""
      4                  style="vertical-align: middle; margin-top: -1px"/></li>
      5         <li><a href="https://www.python.org/">Python</a>{{ reldelim1 }}</li>
      6         <li>
      7           {%- if versionswitcher is defined %}
      8           <span class="version_switcher_placeholder">{{ release }}</span>
      9           <a href="{{ pathto('index') }}">{% trans %}Documentation {% endtrans %}</a>{{ reldelim1 }}
     10           {%- else %}
     11           <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
     12           {%- endif %}
     13         </li>
     14 {% endblock %}
     15 {%- macro searchbox() %}
     16 {# modified from sphinx/themes/basic/searchbox.html #}
     17     {%- if builder != "htmlhelp" %}
     18     <div class="inline-search" style="display: none" role="search">
     19         <form class="inline-search" action="{{ pathto('search') }}" method="get">
     20           <input placeholder="{{ _('Quick search') }}" type="text" name="q" />
     21           <input type="submit" value="{{ _('Go') }}" />
     22           <input type="hidden" name="check_keywords" value="yes" />
     23           <input type="hidden" name="area" value="default" />
     24         </form>
     25     </div>
     26     <script type="text/javascript">$('.inline-search').show(0);</script>
     27     {%- endif %}
     28 {%- endmacro %}
     29 {% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
     30 {% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
     31 {% block relbaritems %}
     32     {%- if pagename != "search" and builder != "singlehtml" and builder != "htmlhelp" %}
     33     <li class="right">
     34         {{ searchbox() }}
     35         {{ reldelim2 }}
     36     </li>
     37     {%- endif %}
     38 {% endblock %}
     39 {% block extrahead %}
     40     <link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
     41     <link rel="canonical" href="https://docs.python.org/3/{{pagename}}.html" />
     42     {% if builder != "htmlhelp" %}
     43     {% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
     44     {% if versionswitcher is defined and not embedded %}<script type="text/javascript" src="{{ pathto('_static/version_switch.js', 1) }}"></script>{% endif %}
     45     {% if pagename == 'whatsnew/changelog' and not embedded %}
     46     <script type="text/javascript">
     47       $(document).ready(function() {
     48           // add the search form and bind the events
     49           $('h1').after([
     50             '<p>Filter entries by content:',
     51             '<input type="text" value="" id="searchbox" style="width: 50%">',
     52             '<input type="submit" id="searchbox-submit" value="Filter"></p>'
     53           ].join('\n'));
     54 
     55           function dofilter() {
     56               try {
     57                   var query = new RegExp($('#searchbox').val(), 'i');
     58               }
     59               catch (e) {
     60                   return; // not a valid regex (yet)
     61               }
     62               // find headers for the versions (What's new in Python X.Y.Z?)
     63               $('#changelog h2').each(function(index1, h2) {
     64                   var h2_parent = $(h2).parent();
     65                   var sections_found = 0;
     66                   // find headers for the sections (Core, Library, etc.)
     67                   h2_parent.find('h3').each(function(index2, h3) {
     68                       var h3_parent = $(h3).parent();
     69                       var entries_found = 0;
     70                       // find all the entries
     71                       h3_parent.find('li').each(function(index3, li) {
     72                           var li = $(li);
     73                           // check if the query matches the entry
     74                           if (query.test(li.text())) {
     75                               li.show();
     76                               entries_found++;
     77                           }
     78                           else {
     79                               li.hide();
     80                           }
     81                       });
     82                       // if there are entries, show the section, otherwise hide it
     83                       if (entries_found > 0) {
     84                           h3_parent.show();
     85                           sections_found++;
     86                       }
     87                       else {
     88                           h3_parent.hide();
     89                       }
     90                   });
     91                   if (sections_found > 0)
     92                       h2_parent.show();
     93                   else
     94                       h2_parent.hide();
     95               });
     96           }
     97           $('#searchbox').keyup(dofilter);
     98           $('#searchbox-submit').click(dofilter);
     99       });
    100     </script>
    101     {% endif %}
    102     {% endif %}
    103 {{ super() }}
    104 {% endblock %}
    105 {% block footer %}
    106     <div class="footer">
    107     &copy; <a href="{{ pathto('copyright') }}">{% trans %}Copyright{% endtrans %}</a> {{ copyright|e }}.
    108     <br />
    109     {% trans %}The Python Software Foundation is a non-profit corporation.{% endtrans %}
    110     <a href="https://www.python.org/psf/donations/">{% trans %}Please donate.{% endtrans %}</a>
    111     <br />
    112     {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
    113     {% trans pathto_bugs=pathto('bugs') %}<a href="{{ pathto_bugs }}">Found a bug</a>?{% endtrans %}
    114     <br />
    115     {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
    116     </div>
    117 {% endblock %}
    118