diff options
| author | Mike Edmunds <medmunds@gmail.com> | 2026-06-08 14:43:44 -0700 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2026-06-09 21:56:35 -0300 |
| commit | 9b1db9cb2c38c75b8fb0fc64ba5f73a6012e5b2d (patch) | |
| tree | 7b8976389754f69cee4c0ecea8542f61fa43672b /docs/_theme/djangodocs/layout.html | |
| parent | 867c7c0451f2e67e715da5b55b5bf6696747fdc3 (diff) | |
Fixed #37150 -- Made djangodocs Sphinx extension work with any html builder.
Changed djangodocs extension to register DjangoHTMLTranslator for any
html-format builder (in the builder-inited hook), rather than a limited
list of builders at startup. That fixes missing content in dirhtml and
standard html builds (including ReadTheDocs PR previews):
- Missing console tabs
- Empty divs for versionadded and versionchanged directives
Removed JS code that depended on jQuery, which hasn't worked since
Sphinx 6.0 dropped jQuery in 2023:
- Unnecessary console tabs click handling. (Console tab behavior is
implemented purely in CSS.)
- Client-side hyperlinking of Django template tags and filters in code
examples. (This is also not supported on docs.djangoproject.com.)
Removed custom DjangoStandaloneHTMLBuilder and "djangohtml" builder
type. Its sole purpose was to generate the "templatebuiltins.js" file
used for the (non-functional) client-side template filter/tag linking.
Changed docs "make html" target from "djangohtml" to standard "html".
Diffstat (limited to 'docs/_theme/djangodocs/layout.html')
| -rw-r--r-- | docs/_theme/djangodocs/layout.html | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/docs/_theme/djangodocs/layout.html b/docs/_theme/djangodocs/layout.html index 487c2b4922..6d07375d07 100644 --- a/docs/_theme/djangodocs/layout.html +++ b/docs/_theme/djangodocs/layout.html @@ -17,60 +17,6 @@ {%- endmacro %} {% block extrahead %} -{# When building htmlhelp (CHM format) disable jQuery inclusion, #} -{# as it causes problems in compiled CHM files. #} -{% if builder != "htmlhelp" %} -{{ super() }} -<script src="{{ pathto('templatebuiltins.js', 1) }}"></script> -<script> -(function($) { - if (!django_template_builtins) { - // templatebuiltins.js missing, do nothing. - return; - } - $(document).ready(function() { - // Hyperlink Django template tags and filters - var base = "{{ pathto('ref/templates/builtins') }}"; - if (base == "#") { - // Special case for builtins.html itself - base = ""; - } - // Tags are keywords, class '.k' - $("div.highlight\\-html\\+django span.k").each(function(i, elem) { - var tagname = $(elem).text(); - if ($.inArray(tagname, django_template_builtins.ttags) != -1) { - var fragment = tagname.replace(/_/, '-'); - $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>"); - } - }); - // Filters are functions, class '.nf' - $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { - var filtername = $(elem).text(); - if ($.inArray(filtername, django_template_builtins.tfilters) != -1) { - var fragment = filtername.replace(/_/, '-'); - $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>"); - } - }); - }); -})(jQuery); -{%- if include_console_assets -%} -(function($) { - $(document).ready(function() { - $(".c-tab-unix").on("click", function() { - $("section.c-content-unix").show(); - $("section.c-content-win").hide(); - $(".c-tab-unix").prop("checked", true); - }); - $(".c-tab-win").on("click", function() { - $("section.c-content-win").show(); - $("section.c-content-unix").hide(); - $(".c-tab-win").prop("checked", true); - }); - }); -})(jQuery); -{%- endif -%} -</script> -{% endif %} {%- if include_console_assets -%} <link rel="stylesheet" href="{{ pathto('_static/console-tabs.css', 1) }}"> {%- endif -%} |
