On 2010-02-05, Fernando Perez wrote: > Hi all, > I need to include some material (exercise solutions) for a doc build > only in certain cases, ... > But I actually need a section title, and calls to source code > inclusion and math directives in there. I tried things like:
> .. ifconfig:: include_solutions==True > Solution > ======== > Solution > .. literalinclude:: examples/wordfreqs.py Section titles cannot be nested in reStructuredText__. __ http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html An easy workaround is to use a rubric instead (if no ToC is required). Docutils circumvents this problem with the `strip-elements-with-class` configuration item like:: .. class:: solution Solution ======== The answer is 42. Question ======== Now we want to know the question. Calling the Docutils converter like rst2html --strip-elements-with-class=solution or setting:: strip-elements-with-class: solution in the config file strip the whole "Question" section up till the next section title of the same level. Comments: I don't know whether the strip-elements-with-class option is implemented in Sphinx. In Sphinx, you might need to write ``.. cssclass::`` for the class argument. Günter -- You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
