【问题标题】:Sphinx latexpdf ignore parts of a fileSphinx latexpdf 忽略文件的一部分
【发布时间】:2020-02-02 18:39:23
【问题描述】:

在使用latexpdf 构建pdf 时,是否可以让Sphinx 忽略index.rst 的一部分?

例如,我的 index.rst 文件包含(但不以)行


.. image:: https://img.shields.io/....
  :target: https://pypi.org/....

.. image::  https://travis-ci.org/....
  :target: https://travis-ci.org/...

.. image:: https://coveralls.io/repos/github/....
  :target: https://coveralls.io/github/....

.. image::  https://readthedocs.org/.....
  :target: https://libensemble.readthedocs.org/....

这些应该出现在构建的 html 中,而不是 PDF 中。我在这里什么都没看到: https://www.sphinx-doc.org/en/master/latex.html

是否可以让 sphinx 忽略这些行?

【问题讨论】:

    标签: latex python-sphinx restructuredtext


    【解决方案1】:

    我认为你可以使用only directive:

    • index.rst
     .. only:: html
    
         .. image::  https://readthedocs.org/.....
         :target: https://libensemble.readthedocs.org/....
    
    • Makefile
     htmldoc:
    
        make -e SPHINXOPTS="-t html" html
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-25
      • 1970-01-01
      相关资源
      最近更新 更多