On Saturday, 26 May 2012 02:34:31 UTC-4, Roger Binns wrote: > > Does anyone have any guidance on how to get Sphinx to play nicely with > ifconfig and toctree? What I want to write is something like this (but > quite a bit more complicated) where the ifconfig choices are mutually > exclusive (only one will ever be true). > Supporting two different build sets with a common set of source files seems to be a common problem with Sphinx.
You might want to investigate the "only::" directive as well as, or instead of, "ifconfig::". 'Only' supports build tags given on the command line to make and passes them through into the running Sphinx app... I /believe/ that "ifconfig" depends on values set in conf.py, and I haven't met with much success trying to pass "configuration values" through from the build process into the running application. The 'tags' that are used as switches in the "only::" directive are accessible in the conf.py file with the 'tags' object, so you might want to investigate using build command line tags in conjunction with "only::" in your sources, plus a conf.py construction that looks something like this: if tags.has('modeA'): # exclude patterns should throw out any modeB-only files exclude_patterns = exclude_patterns + ['modeB_toc.rst'] master_doc = 'modeA_toc.rst' else if tags.has('modeB'): # exclude patterns should throw out any modeA-only files exclude_patterns = exclude_patterns + ['modeA_toc.rst'] master_doc = 'modeB_toc.rst' else: # some default config you're happy to have as default I do something similar to this, but not precisely like it, so I'm not sure if this method will work, or if it will bring more heartache than helpfulness, but it seems like it would work in theory. -- Viktor -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To view this discussion on the web visit https://groups.google.com/d/msg/sphinx-dev/-/oCaL1BzRYmEJ. To post to this group, send email to sphinx-dev@googlegroups.com. To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.