4242source_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.
5148project = 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.
114108pygments_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:
369361def 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