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$
>
> but I cannot seem to get the syntax right.
>
> Any help is greatly appreciated :)
>
> Andreas.

For a similar problem, I use a very ugly but simple workaround in
http://eclipsebook.in/

I use separate conf.py for different formats,

+---latex
|       include-post-conf.txt
|       conf.py
+---epub
|       include-post-conf.txt
|       conf.py
+---html
|       include-post-conf.txt
|       conf.py
\---bookpdf
        include-post-conf.txt
        conf.py

My Makefile has these rules:  (Read -c book/conf/html i.e. Pickup
conf.py from that location)

     HTMLSPHINXOPTS   = -d $(BUILDDIR)/_htmldoctrees    -c book/conf/
html  \
                  $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) book

     LATEXSPHINXOPTS  = -d $(BUILDDIR)/_$(@)doctrees   -c book/conf/$@
\
                  $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) book


All the conf.py have this line:

     rst_epilog = "\n.. include:: /%s/include-post-conf.txt\n\n" %
(os.path.abspath('.'),)


Latex include-post-conf.txt:

   .. |ISBN13STRING| replace:: **ISBN-13**:123-1231231231
   .. |ISBN10STRING| replace:: **ISBN-10**:1231231231

   .. |IDE|                replace:: :abbr:`IDE`
   .. |JVM|                replace:: :abbr:`JVM`

HTML include-post-conf.txt:

   .. |ISBN13STRING| unicode:: U+00020 .. white space..
   .. |ISBN10STRING| unicode:: U+00020 .. white space..


   .. |IDE|                replace:: :abbr:`IDE (Integrated
Development Environment)`
   .. |JVM|                replace:: :abbr:`JVM (Java Virtual
Machine)`


Just my 2 cents & but works for me! :D

--
Purnank

-- 
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.

Reply via email to