Skip to content

Commit a3090a4

Browse files
committed
Issue python#19489: Move the search box from sidebar to header and footer.
1 parent 1140a03 commit a3090a4

4 files changed

Lines changed: 45 additions & 11 deletions

File tree

Doc/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@
6060

6161
# Custom sidebar templates, filenames relative to this file.
6262
html_sidebars = {
63-
'index': 'indexsidebar.html',
63+
# Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars
64+
# Removes the quick search block
65+
'**': ['localtoc.html', 'relations.html', 'customsourcelink.html'],
66+
'index': ['indexsidebar.html'],
6467
}
6568

6669
# Additional templates that should be rendered to pages.

Doc/tools/pydoctheme/static/pydoctheme.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ div.related:first-child {
2222
border-bottom: 1px solid #ccc;
2323
}
2424

25+
.inline-search {
26+
display: inline;
27+
}
28+
form.inline-search input {
29+
display: inline;
30+
}
31+
form.inline-search input[type="submit"] {
32+
width: 30px;
33+
}
34+
2535
div.sphinxsidebar {
2636
background-color: #eeeeee;
2737
border-radius: 5px;
@@ -45,6 +55,7 @@ div.sphinxsidebar a:hover {
4555
color: #0095C4;
4656
}
4757

58+
form.inline-search input,
4859
div.sphinxsidebar input {
4960
font-family: 'Lucida Grande',Arial,sans-serif;
5061
border: 1px solid #999999;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{%- if show_source and has_source and sourcename %}
2+
<div role="note" aria-label="source link">
3+
<h3>{{ _('This Page') }}</h3>
4+
<ul class="this-page-menu">
5+
<li><a href="{{ pathto('bugs') }}">{% trans %}Report a Bug{% endtrans %}</a></li>
6+
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
7+
rel="nofollow">{{ _('Show Source') }}</a></li>
8+
</ul>
9+
</div>
10+
{%- endif %}

Doc/tools/templates/layout.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,28 @@
1212
{%- endif %}
1313
</li>
1414
{% endblock %}
15+
{%- macro searchbox() %}
16+
{# modified from sphinx/themes/basic/searchbox.html #}
17+
<div class="inline-search" style="display: none" role="search">
18+
<form class="inline-search" action="{{ pathto('search') }}" method="get">
19+
<input placeholder="{{ _('Quick search') }}" type="text" name="q" />
20+
<input type="submit" value="{{ _('Go') }}" />
21+
<input type="hidden" name="check_keywords" value="yes" />
22+
<input type="hidden" name="area" value="default" />
23+
</form>
24+
</div>
25+
<script type="text/javascript">$('.inline-search').show(0);</script>
26+
{%- endmacro %}
1527
{% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
1628
{% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
29+
{% block relbaritems %}
30+
{%- if pagename != "search" and builder != "singlehtml" %}
31+
<li class="right">
32+
{{ searchbox() }}
33+
{{ reldelim2 }}
34+
</li>
35+
{%- endif %}
36+
{% endblock %}
1737
{% block extrahead %}
1838
<link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
1939
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
@@ -90,13 +110,3 @@
90110
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
91111
</div>
92112
{% endblock %}
93-
{% block sidebarsourcelink %}
94-
{%- if show_source and has_source and sourcename %}
95-
<h3>{{ _('This Page') }}</h3>
96-
<ul class="this-page-menu">
97-
<li><a href="{{ pathto('bugs') }}">{% trans %}Report a Bug{% endtrans %}</a></li>
98-
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
99-
rel="nofollow">{% trans %}Show Source{% endtrans %}</a></li>
100-
</ul>
101-
{%- endif %}
102-
{% endblock %}

0 commit comments

Comments
 (0)