Skip to content

Commit 597655c

Browse files
authored
Merge branch 'master' into decouple-menu-current-and-expand
2 parents 8c6c503 + 26d6108 commit 597655c

File tree

8 files changed

+75
-53
lines changed

8 files changed

+75
-53
lines changed

docs/changelog.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ master
88

99
:Date: TBD
1010

11-
New Features
12-
-------------
13-
1411
Fixes
1512
-----
1613

14+
* Fix scrolling to active item in sidebar on load (#214)
15+
* Style caption link for code and literal blocks
16+
* Fix inconsistent font size and line height for autodoc "raises" and "returns" (#267)
17+
* Clicking active menu item no longer makes it look inactive (#306)
18+
1719
Other Changes
1820
--------------
1921

docs/configuring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ file of this repository, and can be defined in your project's ``conf.py`` via
1919
2020
html_theme_options = {
2121
'canonical_url': '',
22-
'analytics_id': '',
22+
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
2323
'logo_only': False,
2424
'display_version': True,
2525
'prev_next_buttons_location': 'bottom',

docs/contributing.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,3 @@ you should do the following:
8787
$ rm -rf dist/
8888
$ python setup.py sdist bdist_wheel
8989
$ twine upload --sign --identity [email protected] dist/*
90-
91-
#. In the ``readthedocs.org`` repo, edit the ``bower.json`` file to point at the correct version
92-
(``sphinx-rtd-theme": "https://github.com/rtfd/sphinx-rtd-theme.git#$NEW_VERSION"``).
93-
#. In the ``readthedocs.org`` repo, run ``gulp build`` to update the distributed theme files.

js/theme.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,15 @@ function ThemeNav () {
147147
if (link.length > 0) {
148148
$('.wy-menu-vertical .current').removeClass('current');
149149
link.addClass('current');
150+
150151
link.closest('li.toctree-l1').addClass('current expanded');
151152
link.closest('li.toctree-l1').parent().addClass('current expanded');
152153
link.closest('li.toctree-l1').addClass('current expanded');
153154
link.closest('li.toctree-l2').addClass('current expanded');
154155
link.closest('li.toctree-l3').addClass('current expanded');
155156
link.closest('li.toctree-l4').addClass('current expanded');
157+
158+
link[0].scrollIntoView();
156159
}
157160
}
158161
catch (err) {

sass/_theme_layout.sass

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ html
3131
width: $nav-desktop-width
3232

3333
header, p.caption
34+
color: $nav-caption
3435
height: $base-font-size * 2
3536
display: inline-block
3637
line-height: $base-font-size * 2
3738
padding: 0 $gutter
38-
margin-bottom: 0
39+
margin: $base-line-height / 2 0 0 0
3940
display: block
4041
font-weight: bold
4142
text-transform: uppercase
42-
font-size: 80%
43+
font-size: 85%
4344
white-space: nowrap
4445

4546
ul

sass/_theme_rst.sass

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@
9595
font-size: 12px
9696
line-height: 1.4
9797

98+
.code-block-caption
99+
font-style: italic
100+
font-size: 85%
101+
line-height: 1
102+
padding: 1em 0
103+
text-align: center
104+
98105
@media print
99106
.codeblock, div[class^='highlight'], div[class^='highlight'] pre
100107
white-space: pre-wrap
@@ -165,7 +172,7 @@
165172
@extend h2
166173

167174
// This is the #href that shows up on hover. Sphinx's is terrible so I hack it away.
168-
h1, h2, h3, h4, h5, h6, dl dt, p.caption, table > caption
175+
h1, h2, h3, h4, h5, h6, dl dt, p.caption, table > caption, .code-block-caption
169176
.headerlink
170177
visibility: hidden
171178
font-size: 14px
@@ -263,6 +270,9 @@
263270
border: none
264271
td
265272
border: none
273+
p
274+
font-size: inherit
275+
line-height: inherit
266276
td > strong
267277
display: inline-block
268278
.field-name

sass/_theme_variables.sass

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ $nav-link-color: $blue
5151
$nav-link-color-visited: $purple
5252
$nav-link-color-hover: lighten($nav-link-color, 6%) !default
5353
$nav-link-color-alt: hsl(33, 100%, 51%)
54+
$nav-caption: desaturate($blue, 15%)
5455

5556
// Sidebar colors
5657
$sidebar-background-color: $table-stripe-color

sphinx_rtd_theme/layout.html

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,42 @@
2828
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
2929
{% endif %}
3030

31-
{# CSS #}
32-
33-
{# OPENSEARCH #}
34-
{% if not embedded %}
35-
{% if use_opensearch %}
36-
<link rel="search" type="application/opensearchdescription+xml"
37-
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
38-
href="{{ pathto('_static/opensearch.xml', 1) }}"/>
31+
{# JAVASCRIPTS #}
32+
<script type="text/javascript" src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script>
33+
{%- if not embedded %}
34+
{# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #}
35+
{% if sphinx_version >= "1.8.0" %}
36+
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
37+
{%- for scriptfile in script_files %}
38+
{{ js_tag(scriptfile) }}
39+
{%- endfor %}
40+
{% else %}
41+
<script type="text/javascript">
42+
var DOCUMENTATION_OPTIONS = {
43+
URL_ROOT:'{{ url_root }}',
44+
VERSION:'{{ release|e }}',
45+
LANGUAGE:'{{ language }}',
46+
COLLAPSE_INDEX:false,
47+
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
48+
HAS_SOURCE: {{ has_source|lower }},
49+
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
50+
};
51+
</script>
52+
{%- for scriptfile in script_files %}
53+
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
54+
{%- endfor %}
3955
{% endif %}
56+
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
4057

41-
{% endif %}
58+
{# OPENSEARCH #}
59+
{%- if use_opensearch %}
60+
<link rel="search" type="application/opensearchdescription+xml"
61+
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
62+
href="{{ pathto('_static/opensearch.xml', 1) }}"/>
63+
{%- endif %}
64+
{%- endif %}
4265

66+
{# CSS #}
4367
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
4468
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
4569
{%- for css in css_files %}
@@ -49,6 +73,7 @@
4973
<link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" />
5074
{%- endif %}
5175
{%- endfor %}
76+
5277
{%- for cssfile in extra_css_files %}
5378
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
5479
{%- endfor %}
@@ -74,10 +99,6 @@
7499
{%- endif %}
75100
{%- endblock %}
76101
{%- block extrahead %} {% endblock %}
77-
78-
{# Keep modernizr in head - http://modernizr.com/docs/#installing #}
79-
<script src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script>
80-
81102
</head>
82103

83104
<body class="wy-body-for-nav">
@@ -186,41 +207,29 @@
186207
</div>
187208
{% include "versions.html" %}
188209

189-
{% if not embedded %}
190-
191-
{# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #}
192-
{% if sphinx_version >= "1.8.0" %}
193-
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
194-
{%- for scriptfile in script_files %}
195-
{{ js_tag(scriptfile) }}
196-
{%- endfor %}
197-
{% else %}
198-
<script type="text/javascript">
199-
var DOCUMENTATION_OPTIONS = {
200-
URL_ROOT:'{{ url_root }}',
201-
VERSION:'{{ release|e }}',
202-
LANGUAGE:'{{ language }}',
203-
COLLAPSE_INDEX:false,
204-
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
205-
HAS_SOURCE: {{ has_source|lower }},
206-
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
207-
};
208-
</script>
209-
{%- for scriptfile in script_files %}
210-
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
211-
{%- endfor %}
212-
{% endif %}
213-
214-
{% endif %}
215-
216-
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
217-
218210
<script type="text/javascript">
219211
jQuery(function () {
220212
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
221213
});
222214
</script>
223215

216+
{# Do not conflict with RTD insertion of analytics script #}
217+
{% if not READTHEDOCS %}
218+
{% if theme_analytics_id %}
219+
<!-- Theme Analytics -->
220+
<script>
221+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
222+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
223+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
224+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
225+
226+
ga('create', '{{ theme_analytics_id }}', 'auto');
227+
ga('send', 'pageview');
228+
</script>
229+
230+
{% endif %}
231+
{% endif %}
232+
224233
{%- block footer %} {% endblock %}
225234

226235
</body>

0 commit comments

Comments
 (0)