mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8893 from tk0miya/8885_AttributeError_html_context
Fix #8885: html: AttributeError for CSS/JS files on html_context
This commit is contained in:
commit
66539af2f4
2
CHANGES
2
CHANGES
@ -17,6 +17,8 @@ Bugs fixed
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
* #8884: html: minified js stemmers not included in the distributed package
|
* #8884: html: minified js stemmers not included in the distributed package
|
||||||
|
* #8885: html: AttributeError is raised if CSS/JS files are installed via
|
||||||
|
:confval:`html_context`
|
||||||
* #8880: viewcode: ExtensionError is raised on incremental build after
|
* #8880: viewcode: ExtensionError is raised on incremental build after
|
||||||
unparsable python module found
|
unparsable python module found
|
||||||
|
|
||||||
|
@ -1035,8 +1035,20 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
templatename = newtmpl
|
templatename = newtmpl
|
||||||
|
|
||||||
# sort JS/CSS before rendering HTML
|
# sort JS/CSS before rendering HTML
|
||||||
ctx['script_files'].sort(key=lambda js: js.priority)
|
try:
|
||||||
ctx['css_files'].sort(key=lambda js: js.priority)
|
# Convert script_files to list to support non-list script_files (refs: #8889)
|
||||||
|
ctx['script_files'] = sorted(list(ctx['script_files']), key=lambda js: js.priority)
|
||||||
|
except AttributeError:
|
||||||
|
# Skip sorting if users modifies script_files directly (maybe via `html_context`).
|
||||||
|
# refs: #8885
|
||||||
|
#
|
||||||
|
# Note: priority sorting feature will not work in this case.
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
ctx['css_files'] = sorted(list(ctx['css_files']), key=lambda css: css.priority)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
output = self.templates.render(templatename, ctx)
|
output = self.templates.render(templatename, ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user