用容器替换狮身人面像

发布于 2024-12-25 17:22:12 字数 248 浏览 6 评论 0原文

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

.. |sub| container::

    Some text here

    .. image:: img/some_image.png

    Some other text here

错误消息是

WARNING: Substitution definition "sub" empty or invalid.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没企图 2025-01-01 17:22:12

这是不可能的。 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:: 将其拉入主文件来解决此问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文