用容器替换狮身人面像 [英] Sphinx substitution with a container

查看:104
本文介绍了用容器替换狮身人面像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何替换容器指令?以下内容无效:

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

错误消息是

WARNING: Substitution definition "sub" empty or invalid.


推荐答案

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

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

如果您尝试

.. |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.

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

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

这篇关于用容器替换狮身人面像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆