File tree 3 files changed +26
-1
lines changed
3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 12
12
exclude_patterns = ['html' , 'latex' ]
13
13
if not os .getenv ('BUILD_WEBSITE' ):
14
14
exclude_patterns += ['index.rst' , 'screens.rst' ]
15
+
15
16
if os .getenv ('READTHEDOCS' ):
16
17
# RTD works better with index.html
17
18
html_additional_pages = { 'index' : '_build/html/fityk-manual.html' }
19
+ # RTD has own layout.html. This hack is needed to use all layout.html files.
20
+ template_bridge = "fityk_ext.MyTemplateLoader"
21
+
18
22
templates_path = ['.' ]
19
23
source_suffix = '.rst'
20
24
source_encoding = 'utf-8'
Original file line number Diff line number Diff line change @@ -42,3 +42,21 @@ def setup(app):
42
42
app .add_lexer ('fityk' , FitykLexer ());
43
43
app .connect ('doctree-read' , doctree_read )
44
44
45
+
46
+
47
+ # this is hack is needed to use our layout.html on ReadTheDocs
48
+ from sphinx .jinja2glue import BuiltinTemplateLoader
49
+ class MyTemplateLoader (BuiltinTemplateLoader ):
50
+ def get_source (self , environment , template ):
51
+ print "(MyTemplateLoader.get_source) searching for" , template
52
+ # If template name in Jinja's "extends" is prepended with "!"
53
+ # Sphinx skips project's template paths.
54
+ # In BuiltinTemplateLoader self.templatepathlen is used to remove
55
+ # project's template paths and leave only Sphinx's paths.
56
+ # This hack should leave the last path, so "!layout.html" will find
57
+ # the template from Fityk. To avoid recursion, Fityk template
58
+ # is not using "!".
59
+ self .templatepathlen -= 1
60
+ return BuiltinTemplateLoader .get_source (self , environment , template )
61
+ self .templatepathlen += 1
62
+
Original file line number Diff line number Diff line change 1
- {% extends "!layout.html" %}
1
+ {% extends "sphinxdoc/layout.html" %}
2
+ {# "!" (which is handled by sphinx BuiltinTemplateLoader is not used here,
3
+ to enable nesting in ReadTheDocs build.
4
+ #}
2
5
3
6
{% set reldelim1 = ' ' %}
4
7
{% set reldelim2 = ' ' %}
You can’t perform that action at this time.
0 commit comments