2012-01-09 96 views
2

如何替換容器指令?以下不工作:用容器替換獅身人面像

.. |sub| container:: 

    Some text here 

    .. image:: img/some_image.png 

    Some other text here 

的錯誤消息是

WARNING: Substitution definition "sub" empty or invalid. 

回答

3

這是不可能的。 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::主文件。