【问题标题】:Sphinx substitution with a container用容器替换狮身人面像
【发布时间】:2012-02-06 01:06:29
【问题描述】:

如何替换容器指令?以下不起作用:

.. |sub| container::

    Some text here

    .. image:: img/some_image.png

    Some other text here

错误信息是

WARNING: Substitution definition "sub" empty or invalid.

【问题讨论】:

    标签: containers python-sphinx substitution restructuredtext


    【解决方案1】:

    这是不可能的。 ReST 替换适用于内联文本(单段),但容器是块元素。

    如果你尝试

    .. |sub| replace:: container::
    
        Some text here
    
        .. image:: img/some_image.png
    
        Some other text here
    

    你会得到

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

    您可以通过将容器放在单独的文件中并使用 .. include:: 将其拉入主文件来解决此问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-22
      • 1970-01-01
      • 2010-11-28
      • 1970-01-01
      相关资源
      最近更新 更多