Skip to content

Commit 2c416a8

Browse files
committed
doc: fix latex index exclusion doc for non-latex output
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent b7ae3a2 commit 2c416a8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ $(BUILD_DIR)/module.1: $(BUILD_DIR)/module.1.in
119119

120120
$(BUILD_DIR)/latex/modules.tex: $(SOURCE_DIR)/version.py
121121
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$@
122-
$(SPHINXBUILD) $(SPHINXOPTS) -t latex -b latex "$(SOURCE_DIR)" "$(BUILD_DIR)/latex"
122+
$(SPHINXBUILD) $(SPHINXOPTS) -b latex "$(SOURCE_DIR)" "$(BUILD_DIR)/latex"
123123

124124
$(BUILD_DIR)/latex/modules.pdf: $(BUILD_DIR)/latex/modules.tex
125125
$(ECHO_GEN2) $(ECHO_DIR_PREFIX)$@

doc/source/conf.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@
4242
source_suffix = '.rst'
4343

4444
# The master toctree document.
45-
if 'latex' in tags:
46-
master_doc = 'latex_index'
47-
else:
48-
master_doc = 'index'
45+
master_doc = 'index'
4946

5047
# General information about the project.
5148
project = u'Modules'
@@ -105,10 +102,7 @@ def get_version_release_from_git():
105102
# List of patterns, relative to source directory, that match files and
106103
# directories to ignore when looking for source files.
107104
# This patterns also effect to html_static_path and html_extra_path
108-
if 'latex' in tags:
109-
exclude_patterns = []
110-
else:
111-
exclude_patterns = ['latex_index.rst']
105+
exclude_patterns = []
112106

113107
# The name of the Pygments (syntax highlighting) style to use.
114108
pygments_style = 'sphinx'
@@ -364,9 +358,9 @@ def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
364358
title = nodes.reference('', commit_id, refuri=commit_url)
365359
return [title], []
366360

367-
# define new directive/role that can be used as .. subcmd::/:subcmd:,
368-
# .. mfcmd::/:mfcmd:, .. mfvar::/:mfvar: and .. sitevar::/:sitevar:
369361
def setup(app):
362+
# define new directive/role that can be used as .. subcmd::/:subcmd:,
363+
# .. mfcmd::/:mfcmd:, .. mfvar::/:mfvar: and .. sitevar::/:sitevar:
370364
app.add_object_type('subcmd', 'subcmd',
371365
objname='module sub-command',
372366
indextemplate='pair: %s; module sub-command',
@@ -392,3 +386,9 @@ def setup(app):
392386
indextemplate='pair: %s; module configuration option')
393387
app.add_role('ghcommit', ghcommit_role)
394388

389+
# exclude latex index document on non-latex output builder
390+
def on_builder_inited(app):
391+
if app.builder.name != 'latex':
392+
app.config.exclude_patterns.append('latex_index.rst')
393+
394+
app.connect('builder-inited', on_builder_inited)

0 commit comments

Comments
 (0)