복붙노트

[PYTHON] Sphinx 문서의 조건부 출력

PYTHON

Sphinx 문서의 조건부 출력

나는 Sphinx에 관한 문서를 쓰고 있는데 LaTeX 문서가 아닌 HTML 문서만을위한 특정 블록을 인쇄하고 싶다. 뭔가 sphinx.ext.ifconfig로이 작업을 수행 할 수 있어야한다는 것을 알지만 어떻게 해결할 수 있는지 알 수 없습니다. 누구든지이 작업을 수행하는 방법을 알고 있습니까?

해결법

  1. ==============================

    1.연장은 필요하지 않습니다. 유일한 지침을 사용하십시오. 그것은 다음과 같이 작동합니다 :

    연장은 필요하지 않습니다. 유일한 지침을 사용하십시오. 그것은 다음과 같이 작동합니다 :

    .. 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.
    
  2. from https://stackoverflow.com/questions/2215518/conditional-output-in-sphinx-documentation by cc-by-sa and MIT license