Sphinx substitution with a container

纵然是瞬间 提交于 2019-12-12 13:10:35

问题


How can I substitute a container directive ? The following doesn't work:

.. |sub| container::

    Some text here

    .. image:: img/some_image.png

    Some other text here

The error message is

WARNING: Substitution definition "sub" empty or invalid.

回答1:


This is not possible. ReST substitutions apply to inline text (single paragraphs), but a container is a block element.

And if you try

.. |sub| replace:: container::

    Some text here

    .. image:: img/some_image.png

    Some other text here

you will get

ERROR: Error in "replace" directive: may contain a single paragraph only.

You could work around this by putting the container in a separate file and pull it in to the master file using .. include::.



来源:https://stackoverflow.com/questions/8789408/sphinx-substitution-with-a-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!