Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0cf44a

Browse files
committed
DOC modified sphinx's layout.hml
The previous sphinx layout relied on overriding a default template. It meant we could not easily add links and other things in the header. The new layout does not inherit from anything, hence makes it easier to tune.
1 parent 1668411 commit e0cf44a

File tree

2 files changed

+244
-42
lines changed

2 files changed

+244
-42
lines changed

doc/_static/mpl.css

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
body {
7-
font-family: "Raleway", "Helvetica Neue", Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
7+
font-family: "Helvetica Neue", Helvetica, 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
88
font-size: 14px;
99
letter-spacing: -0.01em;
1010
line-height: 150%;
@@ -13,7 +13,7 @@ body {
1313
color: black;
1414
padding: 0;
1515
border: 1px solid #aaa;
16-
16+
color: #333;
1717
margin: 0px 80px 0px 80px;
1818
min-width: 740px;
1919
}
@@ -32,12 +32,17 @@ a:hover {
3232
}
3333

3434
pre {
35-
font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
36-
font-size: 0.95em;
35+
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
36+
font-size: 0.90em;
37+
border-bottom-left-radius: 4px;
38+
border-bottom-right-radius: 4px;
39+
border-top-left-radius: 4px;
40+
border-top-right-radius: 4px;
3741
letter-spacing: 0.015em;
38-
padding: 0.5em;
42+
padding: 1em;
3943
border: 1px solid #ccc;
4044
background-color: #f8f8f8;
45+
line-height: 140%;
4146
}
4247

4348
td.linenos pre {
@@ -125,7 +130,7 @@ dd {
125130

126131
dt:target,
127132
.highlight {
128-
background-color: #fbe54e;
133+
background-color: #ffffee;
129134
}
130135

131136
dl.class, dl.function {
@@ -141,13 +146,9 @@ dl.glossary dt {
141146
font-size: 1.1em;
142147
}
143148

144-
pre {
145-
line-height: 120%;
146-
}
147-
148149
pre a {
149150
color: inherit;
150-
text-decoration: underline;
151+
text-decoration: none;
151152
}
152153

153154
.first {
@@ -218,10 +219,6 @@ div.bodywrapper {
218219
border-right: 1px solid #ccc;
219220
}
220221

221-
div.body a {
222-
text-decoration: underline;
223-
}
224-
225222
div.sphinxsidebar {
226223
margin: 0;
227224
padding: 0.5em 15px 15px 0;
@@ -263,14 +260,15 @@ p.rubric {
263260

264261
h1 {
265262
margin: 0;
266-
padding: 0.7em 0 0.3em 0;
267-
font-size: 1.5em;
263+
padding-top: 0.5em;
264+
font-size: 2em;
268265
color: #11557C;
269266
}
270267

271268
h2 {
272-
margin: 1.3em 0 0.2em 0;
273-
font-size: 1.35em;
269+
margin: 0.5em 0 0.2em 0;
270+
padding-top: 0.5em;
271+
font-size: 1.7em;
274272
padding: 0;
275273
}
276274

@@ -359,9 +357,6 @@ div.sphinxsidebar ul.toc ul li {
359357

360358
div.admonition, div.warning {
361359
font-size: 0.9em;
362-
margin: 1em 0 0 0;
363-
border: 1px solid #86989B;
364-
background-color: #f7f7f7;
365360
}
366361

367362
div.admonition p, div.warning p {
@@ -376,11 +371,8 @@ div.admonition pre, div.warning pre {
376371
div.admonition p.admonition-title,
377372
div.warning p.admonition-title {
378373
margin: 0;
379-
padding: 0.1em 0 0.1em 0.5em;
380-
color: white;
381-
border-bottom: 1px solid #86989B;
382374
font-weight: bold;
383-
background-color: #AFC1C4;
375+
font-size: 14px;
384376
}
385377

386378
div.warning {
@@ -518,14 +510,6 @@ table.docutils {
518510
border-left-width: 0px;
519511
}
520512

521-
table.docutils tr:nth-child(even) {
522-
background-color: #F3F3FF;
523-
}
524-
525-
table.docutils tr:nth-child(odd) {
526-
background-color: #FFFFEE;
527-
}
528-
529513
/* module summary table */
530514
.longtable.docutils {
531515
font-size: 12px;

doc/_templates/layout.html

Lines changed: 226 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,183 @@
1-
{% extends "!layout.html" %}
1+
{#
2+
basic/layout.html
3+
~~~~~~~~~~~~~~~~~
24

3-
<link href="http://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">
5+
Master layout template for Sphinx themes.
6+
7+
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
8+
:license: BSD, see LICENSE for details.
9+
#}
10+
{%- block doctype -%}
11+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
12+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
13+
{%- endblock %}
14+
{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
15+
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
16+
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
17+
(sidebars != []) %}
18+
{%- set url_root = pathto('', 1) %}
19+
{# XXX necessary? #}
20+
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
21+
{%- if not embedded and docstitle %}
22+
{%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
23+
{%- else %}
24+
{%- set titlesuffix = "" %}
25+
{%- endif %}
26+
27+
{%- macro relbar() %}
28+
<div class="related">
29+
<h3>{{ _('Navigation') }}</h3>
30+
<ul>
31+
{%- for rellink in rellinks %}
32+
<li class="right" {% if loop.first %}style="margin-right: 10px"{%
33+
endif %}>
34+
<a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags|e
35+
}}"
36+
{{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a>
37+
{%- if not loop.first %}{{ reldelim2 }}{% endif %}</li>
38+
{%- endfor %}
439

5-
{% block rootrellink %}
640
<li><a href="{{ pathto('index') }}">home</a>|&nbsp;</li>
741
<li><a href="{{ pathto('examples/index') }}">examples</a>|&nbsp;</li>
842
<li><a href="{{ pathto('gallery') }}">gallery</a>|&nbsp;</li>
943
<li><a href="{{ pathto('api/pyplot_summary') }}">pyplot</a>|&nbsp;</li>
1044
<li><a href="{{ pathto('contents') }}">docs</a> &raquo;</li>
11-
{% endblock %}
1245

46+
{%- for parent in parents %}
47+
<li><a href="{{ parent.link|e }}" {% if loop.last %}{{
48+
accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li>
49+
{%- endfor %}
50+
{%- block relbaritems %} {% endblock %}
51+
</ul>
52+
</div>
53+
{%- endmacro %}
54+
55+
{%- macro sidebar() %}
56+
{%- if render_sidebar %}
57+
<div class="sphinxsidebar">
58+
<div class="sphinxsidebarwrapper">
59+
{%- block sidebarlogo %}
60+
{%- if logo %}
61+
<p class="logo"><a href="{{ pathto(master_doc) }}">
62+
<img class="logo" src="{{ pathto('_static/' + logo, 1) }}"
63+
alt="Logo"/>
64+
</a></p>
65+
{%- endif %}
66+
{%- endblock %}
67+
{%- if sidebars != None %}
68+
{#- new style sidebar: explicitly include/exclude templates #}
69+
{%- for sidebartemplate in sidebars %}
70+
{%- include sidebartemplate %}
71+
{%- endfor %}
72+
{%- else %}
73+
{#- old style sidebars: using blocks -- should be deprecated #}
74+
{%- block sidebartoc %}
75+
{%- include "localtoc.html" %}
76+
{%- endblock %}
77+
{%- block sidebarrel %}
78+
{%- include "relations.html" %}
79+
{%- endblock %}
80+
{%- block sidebarsourcelink %}
81+
{%- include "sourcelink.html" %}
82+
{%- endblock %}
83+
{%- if customsidebar %}
84+
{%- include customsidebar %}
85+
{%- endif %}
86+
{%- block sidebarsearch %}
87+
{%- include "searchbox.html" %}
88+
{%- endblock %}
89+
{%- endif %}
90+
</div>
91+
</div>
92+
{%- endif %}
93+
{%- endmacro %}
94+
95+
{%- macro script() %}
96+
<script type="text/javascript">
97+
var DOCUMENTATION_OPTIONS = {
98+
URL_ROOT: '{{ url_root }}',
99+
VERSION: '{{ release|e }}',
100+
COLLAPSE_INDEX: false,
101+
FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
102+
HAS_SOURCE: {{ has_source|lower }}
103+
};
104+
</script>
105+
{%- for scriptfile in script_files %}
106+
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
107+
{%- endfor %}
108+
{%- endmacro %}
109+
110+
{%- macro css() %}
111+
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}"
112+
type="text/css" />
113+
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}"
114+
type="text/css" />
115+
{%- for cssfile in css_files %}
116+
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
117+
{%- endfor %}
118+
{%- endmacro %}
119+
120+
<html xmlns="http://www.w3.org/1999/xhtml">
121+
<head>
122+
<meta http-equiv="Content-Type" content="text/html; charset={{ encoding
123+
}}" />
124+
{{ metatags }}
125+
{%- block htmltitle %}
126+
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
127+
{%- endblock %}
128+
{{ css() }}
129+
{%- if not embedded %}
130+
{{ script() }}
131+
{%- if use_opensearch %}
132+
<link rel="search" type="application/opensearchdescription+xml"
133+
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle
134+
}}{% endtrans %}"
135+
href="{{ pathto('_static/opensearch.xml', 1) }}"/>
136+
{%- endif %}
137+
{%- if favicon %}
138+
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
139+
{%- endif %}
140+
{%- endif %}
141+
{%- block linktags %}
142+
{%- if hasdoc('about') %}
143+
<link rel="author" title="{{ _('About these documents') }}" href="{{
144+
pathto('about') }}" />
145+
{%- endif %}
146+
{%- if hasdoc('genindex') %}
147+
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}"
148+
/>
149+
{%- endif %}
150+
{%- if hasdoc('search') %}
151+
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}"
152+
/>
153+
{%- endif %}
154+
{%- if hasdoc('copyright') %}
155+
<link rel="copyright" title="{{ _('Copyright') }}" href="{{
156+
pathto('copyright') }}" />
157+
{%- endif %}
158+
<link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
159+
{%- if parents %}
160+
<link rel="up" title="{{ parents[-1].title|striptags|e }}" href="{{
161+
parents[-1].link|e }}" />
162+
{%- endif %}
163+
{%- if next %}
164+
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e
165+
}}" />
166+
{%- endif %}
167+
{%- if prev %}
168+
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e
169+
}}" />
170+
{%- endif %}
171+
{%- endblock %}
172+
{%- block extrahead %} {% endblock %}
173+
<link href="http://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">
174+
175+
</head>
176+
<body>
177+
{%- block header %}{% endblock %}
13178

14179
{% block relbar1 %}
180+
15181
<!-- Piwik -->
16182
<script type="text/javascript">
17183
if ("matplotlib.sourceforge.net" == document.location.hostname ||
@@ -44,9 +210,61 @@
44210
pathto("_static/logo2.png", 1) }}" border="0" alt="matplotlib"/></a>
45211
</div>
46212

47-
{{ super() }}
48213
{% endblock %}
49214

50-
{# put the sidebar before the body #}
51-
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
52-
{% block sidebar2 %}{% endblock %}
215+
{%- block relbar2 %}
216+
217+
{{ relbar() }}
218+
219+
{% endblock %}
220+
221+
222+
223+
{%- block content %}
224+
{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
225+
226+
{%- block sidebar2 %}{{ sidebar() }}{% endblock %}
227+
228+
<div class="document">
229+
{%- block document %}
230+
<div class="documentwrapper">
231+
{%- if render_sidebar %}
232+
<div class="bodywrapper">
233+
{%- endif %}
234+
<div class="body">
235+
{% block body %} {% endblock %}
236+
</div>
237+
{%- if render_sidebar %}
238+
</div>
239+
{%- endif %}
240+
</div>
241+
{%- endblock %}
242+
243+
<div class="clearer"></div>
244+
</div>
245+
{%- endblock %}
246+
247+
{%- block footer %}
248+
<div class="footer">
249+
{%- if show_copyright %}
250+
{%- if hasdoc('copyright') %}
251+
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a
252+
href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
253+
{%- else %}
254+
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{%
255+
endtrans %}
256+
{%- endif %}
257+
{%- endif %}
258+
{%- if last_updated %}
259+
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated
260+
}}.{% endtrans %}
261+
{%- endif %}
262+
{%- if show_sphinx %}
263+
{% trans sphinx_version=sphinx_version|e %}Created using <a
264+
href="http://sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
265+
{%- endif %}
266+
</div>
267+
{%- endblock %}
268+
269+
</body>
270+
</html>

0 commit comments

Comments
 (0)