On 2012-01-10, Purnank H G wrote:
> On Jan 10, 1:16 am, andreash <hilb...@gmail.com> wrote: >> Hi Sphinx experts, >> how can I make a substitution depending on the output-format? >> Basically, I would like to have something like this:: >> if html: >> |CLICK| unicode:: U+21E8 >> elif latex: >> |CLICK| raw:: latex >> $\LongRightArrow$ > For a similar problem, I use a very ugly but simple workaround in > http://eclipsebook.in/ > I use separate conf.py for different formats, ... > All the conf.py have this line: > rst_epilog = "\n.. include:: /%s/include-post-conf.txt\n\n" % > (os.path.abspath('.'),) ... An implementation of this idea in reStructuredText would be a new "format" keyword for the include directive http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment that acts like the format specifier in "raw" and "raw"-defived roles http://docutils.sourceforge.net/docs/ref/rst/roles.html#raw. Example:: .. include:: latex-substitutions.txt :format: latex .. include:: substitutions.txt :format: html xml pseudoxml manpage This could be implemented in Docutils (which means it would automatically work in Sphinx after installing of the "augmented" Docutils version). 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 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.