Georg Brandl avatar Georg Brandl committed 77eef74

#387: Fix the display of search results in ``dirhtml`` output.

Comments (0)

Files changed (3)

 Release 0.6.6 (in development)
 ==============================
 
+* #387: Fix the display of search results in ``dirhtml`` output.
+
 * #370: Fix handling of complex list item labels in LaTeX output.
 
 * #374: Make the ``doctest_path`` config value of the doctest

sphinx/themes/basic/layout.html

 {%- endblock %}
 {%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %}
 {%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
+{%- set url_root = pathto('', 1) %}
+{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
 
 {%- macro relbar() %}
     <div class="related">
     {%- if not embedded %}
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-        URL_ROOT:    '{{ pathto("", 1) }}',
+        URL_ROOT:    '{{ url_root }}',
         VERSION:     '{{ release|e }}',
         COLLAPSE_MODINDEX: false,
         FILE_SUFFIX: '{{ file_suffix }}',

sphinx/themes/basic/static/searchtools.js

             displayNextItem();
           });
         } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
-          $.get('_sources/' + item[0] + '.txt', function(data) {
+          $.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
+                item[0] + '.txt', function(data) {
             listItem.append($.makeSearchSummary(data, searchterms, hlterms));
             Search.output.append(listItem);
             listItem.slideDown(5, function() {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.