summaryrefslogtreecommitdiff
path: root/sphinx/themes/basic/layout.html
diff options
context:
space:
mode:
authorJellby <jellby@yahoo.com>2017-04-15 17:07:33 +0200
committerJellby <jellby@yahoo.com>2017-04-15 17:07:33 +0200
commite59a8028d7a68d0e0d915770764566db5951cb26 (patch)
treee6ea7ac4846259acd0523b3ca62bf8e6e4e7cdd1 /sphinx/themes/basic/layout.html
parent1cfed262d2ce9d05f573dea6f6bc5067c752a427 (diff)
downloadsphinx-git-e59a8028d7a68d0e0d915770764566db5951cb26.tar.gz
Rewrite and simplify stylesheet handling
Thanks to tk0miya's comment, I learnt one can add stuff to template blocks, that allows a much simpler stylesheet configuration, considering that changes at the template level will be more... well, low-level. Hopefully this is now acceptable.
Diffstat (limited to 'sphinx/themes/basic/layout.html')
-rw-r--r--sphinx/themes/basic/layout.html24
1 files changed, 6 insertions, 18 deletions
diff --git a/sphinx/themes/basic/layout.html b/sphinx/themes/basic/layout.html
index e6e2b2ba4..4f1d71202 100644
--- a/sphinx/themes/basic/layout.html
+++ b/sphinx/themes/basic/layout.html
@@ -105,24 +105,8 @@
{%- macro css() %}
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
- {#- Process the custom css files, with their alternate and title properties if available #}
- {%- for cssfile in css_files %}
- {%- if css_props[cssfile] is not defined %}
- {%- set alt = False %}
- {%- set csstitle = undefined %}
- {%- else %}
- {%- set csstitle = css_props[cssfile].title %}
- {%- set alt = (csstitle is defined) %}
- {%- if css_props[cssfile].alternate is defined %}
- {%- set alt = css_props[cssfile].alternate %}
- {%- endif %}
- {%- endif %}
- {%- if alt %}
- {%- set rel = "alternate stylesheet" %}
- {%- else %}
- {%- set rel = "stylesheet" %}
- {%- endif %}
- <link rel="{{ rel }}" href="{{ pathto(cssfile, 1) }}" type="text/css"{% if csstitle is defined %} title="{{ csstitle }}"{% endif %} />
+ {%- for css in css_files %}
+ <link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
{%- endfor %}
{%- endmacro %}
@@ -133,9 +117,13 @@
{%- block htmltitle %}
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{%- endblock %}
+ {%- block csss %}
{{ css() }}
+ {%- endblock %}
{%- if not embedded %}
+ {%- block scripts %}
{{ script() }}
+ {%- endblock %}
{%- if use_opensearch %}
<link rel="search" type="application/opensearchdescription+xml"
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"