Skip to content

Commit f913b58

Browse files
authored
Merge pull request #2842 from jreklund/ug-fouc
Improve flash of unstyled content in userguide
2 parents 7f16a9a + 8103879 commit f913b58

3 files changed

Lines changed: 244 additions & 3 deletions

File tree

user_guide_src/source/_static/css/citheme.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ div#pulldown-menu {
246246
margin-right: 0.65em;
247247
}
248248

249+
.wy-menu-vertical li span.toctree-expand::before {
250+
display: none !important;
251+
}
252+
249253
/* Elements ----------------------------------------------------------------- */
250254

251255
.highlighted {
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
{# TEMPLATE VAR SETTINGS #}
2+
{%- set url_root = pathto('', 1) %}
3+
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
4+
{%- if not embedded and docstitle %}
5+
{%- set titlesuffix = " — "|safe + docstitle|e %}
6+
{%- else %}
7+
{%- set titlesuffix = "" %}
8+
{%- endif %}
9+
{%- set lang_attr = 'en' if language == None else (language | replace('_', '-')) %}
10+
11+
<!DOCTYPE html>
12+
<!--[if IE 8]><html class="no-js lt-ie9" lang="{{ lang_attr }}" > <![endif]-->
13+
<!--[if gt IE 8]><!--> <html class="no-js" lang="{{ lang_attr }}" > <!--<![endif]-->
14+
<head>
15+
<meta charset="utf-8">
16+
{{ metatags }}
17+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
18+
{% block htmltitle %}
19+
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
20+
{% endblock %}
21+
22+
{# FAVICON #}
23+
{% if favicon %}
24+
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
25+
{% endif %}
26+
{# CANONICAL URL #}
27+
{% if theme_canonical_url %}
28+
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
29+
{% endif %}
30+
31+
{# CSS #}
32+
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
33+
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
34+
{%- for css in css_files %}
35+
{%- if css|attr("rel") %}
36+
<link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
37+
{%- else %}
38+
<link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" />
39+
{%- endif %}
40+
{%- endfor %}
41+
42+
{%- for cssfile in extra_css_files %}
43+
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
44+
{%- endfor %}
45+
46+
{# JAVASCRIPTS #}
47+
<script type="text/javascript" src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script>
48+
{%- if not embedded %}
49+
{# 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 #}
50+
{% if sphinx_version >= "1.8.0" %}
51+
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
52+
{%- for scriptfile in script_files %}
53+
{{ js_tag(scriptfile) }}
54+
{%- endfor %}
55+
{% else %}
56+
<script type="text/javascript">
57+
var DOCUMENTATION_OPTIONS = {
58+
URL_ROOT:'{{ url_root }}',
59+
VERSION:'{{ release|e }}',
60+
LANGUAGE:'{{ language }}',
61+
COLLAPSE_INDEX:false,
62+
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
63+
HAS_SOURCE: {{ has_source|lower }},
64+
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
65+
};
66+
</script>
67+
{%- for scriptfile in script_files %}
68+
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
69+
{%- endfor %}
70+
{% endif %}
71+
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
72+
73+
{# OPENSEARCH #}
74+
{%- if use_opensearch %}
75+
<link rel="search" type="application/opensearchdescription+xml"
76+
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
77+
href="{{ pathto('_static/opensearch.xml', 1) }}"/>
78+
{%- endif %}
79+
{%- endif %}
80+
81+
{%- block linktags %}
82+
{%- if hasdoc('about') %}
83+
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
84+
{%- endif %}
85+
{%- if hasdoc('genindex') %}
86+
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
87+
{%- endif %}
88+
{%- if hasdoc('search') %}
89+
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
90+
{%- endif %}
91+
{%- if hasdoc('copyright') %}
92+
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
93+
{%- endif %}
94+
{%- if next %}
95+
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
96+
{%- endif %}
97+
{%- if prev %}
98+
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
99+
{%- endif %}
100+
{%- endblock %}
101+
{%- block extrahead %} {% endblock %}
102+
</head>
103+
104+
<body class="wy-body-for-nav">
105+
106+
{% block extrabody %} {% endblock %}
107+
<div class="wy-grid-for-nav">
108+
{# SIDE NAV, TOGGLES ON MOBILE #}
109+
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
110+
<div class="wy-side-scroll">
111+
<div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
112+
{% block sidebartitle %}
113+
114+
{% if logo and theme_logo_only %}
115+
<a href="{{ pathto(master_doc) }}">
116+
{% else %}
117+
<a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}
118+
{% endif %}
119+
120+
{% if logo %}
121+
{# Not strictly valid HTML, but it's the only way to display/scale
122+
it properly, without weird scripting or heaps of work
123+
#}
124+
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="Logo"/>
125+
{% endif %}
126+
</a>
127+
128+
{% if theme_display_version %}
129+
{%- set nav_version = version %}
130+
{% if READTHEDOCS and current_version %}
131+
{%- set nav_version = current_version %}
132+
{% endif %}
133+
{% if nav_version %}
134+
<div class="version">
135+
{{ nav_version }}
136+
</div>
137+
{% endif %}
138+
{% endif %}
139+
140+
{% include "searchbox.html" %}
141+
142+
{% endblock %}
143+
</div>
144+
145+
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
146+
{% block menu %}
147+
{#
148+
The singlehtml builder doesn't handle this toctree call when the
149+
toctree is empty. Skip building this for now.
150+
#}
151+
{% if 'singlehtml' not in builder %}
152+
{% set global_toc = toctree(maxdepth=theme_navigation_depth|int,
153+
collapse=theme_collapse_navigation|tobool,
154+
includehidden=theme_includehidden|tobool,
155+
titles_only=theme_titles_only|tobool) %}
156+
{% endif %}
157+
{% if global_toc %}
158+
{{ global_toc }}
159+
{% else %}
160+
<!-- Local TOC -->
161+
<div class="local-toc">{{ toc }}</div>
162+
{% endif %}
163+
{% endblock %}
164+
</div>
165+
</div>
166+
</nav>
167+
168+
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
169+
170+
{# MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
171+
<nav class="wy-nav-top" aria-label="top navigation">
172+
{% block mobile_nav %}
173+
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
174+
<a href="{{ pathto(master_doc) }}">{{ project }}</a>
175+
{% endblock %}
176+
</nav>
177+
178+
179+
<div class="wy-nav-content">
180+
{%- block content %}
181+
{% if theme_style_external_links|tobool %}
182+
<div class="rst-content style-external-links">
183+
{% else %}
184+
<div class="rst-content">
185+
{% endif %}
186+
{% include "breadcrumbs.html" %}
187+
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
188+
{%- block document %}
189+
<div itemprop="articleBody">
190+
{% block body %}{% endblock %}
191+
</div>
192+
{% if self.comments()|trim %}
193+
<div class="articleComments">
194+
{% block comments %}{% endblock %}
195+
</div>
196+
{% endif%}
197+
</div>
198+
{%- endblock %}
199+
{% include "footer.html" %}
200+
</div>
201+
{%- endblock %}
202+
</div>
203+
204+
</section>
205+
206+
</div>
207+
{% include "versions.html" %}
208+
209+
<script type="text/javascript">
210+
jQuery(function () {
211+
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
212+
});
213+
</script>
214+
215+
{# Do not conflict with RTD insertion of analytics script #}
216+
{% if not READTHEDOCS %}
217+
{% if theme_analytics_id %}
218+
<!-- Theme Analytics -->
219+
<script>
220+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
221+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
222+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
223+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
224+
225+
ga('create', '{{ theme_analytics_id }}', 'auto');
226+
ga('send', 'pageview');
227+
</script>
228+
229+
{% endif %}
230+
{% endif %}
231+
232+
{%- block footer %} {% endblock %}
233+
234+
</body>
235+
</html>

user_guide_src/source/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
html_theme_options = {
7575
'collapse_navigation': False,
7676
'sticky_navigation': False,
77+
'navigation_depth': 2,
7778
'includehidden': False,
7879
'logo_only': True,
7980
'display_version': False,
@@ -93,16 +94,17 @@
9394
# pixels large.
9495
html_favicon = '_static/favicon.ico'
9596

97+
# The name of an style sheet to use for HTML pages.
98+
html_style = 'css/citheme.css'
99+
96100
# Output file base name for HTML help builder.
97101
htmlhelp_basename = 'CodeIgniterdoc'
98102

99103
# If true, the reST sources are included in the HTML build as _sources/name.
100104
html_copy_source = False
101105

102106
# A list of CSS files.
103-
html_css_files = [
104-
'css/citheme.css',
105-
]
107+
html_css_files = []
106108

107109
# A list of JS files.
108110
html_js_files = [

0 commit comments

Comments
 (0)