2010-02-07 27 views
19

estoy escribiendo algún tipo de documentación con Sphinx y me gustaría para imprimir un determinado bloque de texto sólo para la documentación HTML, no para la documentación de LaTeX. Algo me dice que debería poder hacer esto con sphinx.ext.ifconfig pero no puedo entender cómo. ¿Alguien sabe como hacer esto?salida condicional en Sphinx Documentación

Respuesta

25

No se requiere extensión. Simplemente use el only directive. Funciona así:

 
.. only:: latex 

    The stuff in here only appears in the latex output. 

.. only:: html 

    The stuff in this block only appears in the HTML output. It's 
    often useful to use this directive with it: 

    .. raw:: html 

     It's good for embedding stuff, like video. 
+0

¿Es posible discernir entre 'singlehtml' y' html'? – Carel

+0

@Carel sí, con Sphinx 1.2 y posteriores, se puede distinguir entre '' html' y singlehtml' usando las etiquetas constructor explícitas '' builder_html' y builder_singlehtml'. – ddbeck

+0

podría echar un vistazo a una pregunta similar. http://stackoverflow.com/questions/42798152/adding-custom-tag-in-sphinx – Learner

Cuestiones relacionadas