From a3090a4b79aa16f742d465aea894f148a00ae2c5 Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Fri, 9 Sep 2016 13:11:27 -0700 Subject: [PATCH] Issue #19489: Move the search box from sidebar to header and footer. --- Doc/conf.py | 5 +++- Doc/tools/pydoctheme/static/pydoctheme.css | 11 ++++++++ Doc/tools/templates/customsourcelink.html | 10 ++++++++ Doc/tools/templates/layout.html | 30 ++++++++++++++-------- 4 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 Doc/tools/templates/customsourcelink.html diff --git a/Doc/conf.py b/Doc/conf.py index d6f20ba25c4..b1bb6208bb4 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -60,7 +60,10 @@ templates_path = ['tools/templates'] # Custom sidebar templates, filenames relative to this file. html_sidebars = { - 'index': 'indexsidebar.html', + # Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars + # Removes the quick search block + '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'], + 'index': ['indexsidebar.html'], } # Additional templates that should be rendered to pages. diff --git a/Doc/tools/pydoctheme/static/pydoctheme.css b/Doc/tools/pydoctheme/static/pydoctheme.css index e24043f02de..1d5c18e5f62 100644 --- a/Doc/tools/pydoctheme/static/pydoctheme.css +++ b/Doc/tools/pydoctheme/static/pydoctheme.css @@ -22,6 +22,16 @@ div.related:first-child { border-bottom: 1px solid #ccc; } +.inline-search { + display: inline; +} +form.inline-search input { + display: inline; +} +form.inline-search input[type="submit"] { + width: 30px; +} + div.sphinxsidebar { background-color: #eeeeee; border-radius: 5px; @@ -45,6 +55,7 @@ div.sphinxsidebar a:hover { color: #0095C4; } +form.inline-search input, div.sphinxsidebar input { font-family: 'Lucida Grande',Arial,sans-serif; border: 1px solid #999999; diff --git a/Doc/tools/templates/customsourcelink.html b/Doc/tools/templates/customsourcelink.html new file mode 100644 index 00000000000..243d8107779 --- /dev/null +++ b/Doc/tools/templates/customsourcelink.html @@ -0,0 +1,10 @@ +{%- if show_source and has_source and sourcename %} +
+

{{ _('This Page') }}

+ +
+{%- endif %} diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 1887b85b607..8923d9a09dc 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -12,8 +12,28 @@ {%- endif %} {% endblock %} +{%- macro searchbox() %} +{# modified from sphinx/themes/basic/searchbox.html #} + + +{%- endmacro %} {% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %} {% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %} +{% block relbaritems %} + {%- if pagename != "search" and builder != "singlehtml" %} +
  • + {{ searchbox() }} + {{ reldelim2 }} +
  • + {%- endif %} +{% endblock %} {% block extrahead %} {% if not embedded %}{% endif %} @@ -90,13 +110,3 @@ {% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %} {% endblock %} -{% block sidebarsourcelink %} -{%- if show_source and has_source and sourcename %} -

    {{ _('This Page') }}

    - -{%- endif %} -{% endblock %}