简体   繁体   English

如何在带有 Sphinx 的 reStructuredText 中包含一个 plantuml 文件

[英]How can I include a plantuml file in reStructuredText with Sphinx

I have a plantuml file composite.puml with the following content:我有一个带有以下内容的 plantuml 文件composite.puml

package composite {
  class Letter {
    + __init__(char: str)
    # print_this_before()
  }

And I try to include this in a reStructuredText document (which uses the sphinxcontrib.plantuml plugin):我尝试将其包含在 reStructuredText 文档中(使用sphinxcontrib.plantuml插件):

.. uml::
    .. include:: composite.puml

But this throws an exception when running make html但这在运行make html时会引发异常

Running Sphinx v2.4.1
/Users/jve23941
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 10 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] structural_patterns/composite
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:51: WARNING: Bullet list ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:52: WARNING: Definition list ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:54: WARNING: Unexpected indentation.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:57: WARNING: Bullet list ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:59: WARNING: Block quote ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:61: WARNING: Unexpected indentation.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:63: WARNING: Block quote ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:65: WARNING: Unexpected indentation.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:65: WARNING: Inline emphasis start-string without end-string.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:66: WARNING: Bullet list ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:67: WARNING: Block quote ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:69: WARNING: Unexpected indentation.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:69: WARNING: Inline emphasis start-string without end-string.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:70: WARNING: Inline emphasis start-string without end-string.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:71: WARNING: Bullet list ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:72: WARNING: Block quote ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:73: WARNING: Definition list ends without a blank line; unexpected unindent.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:73: WARNING: Inline substitution_reference start-string without end-string.
/Users/jve23941/workspace/python-design-patterns/docs/structural_patterns/composite.rst:73: WARNING: Undefined substitution referenced: "> LetterComposite Sentence --".
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] structural_patterns/index
generating indices...  genindex py-modindexdone
highlighting module code... [100%] python_design_patterns.composite
writing additional pages...  search/Users/jve23941/workspace/python-design-patterns/.venv/lib/python3.8/site-packages/sphinx_rtd_theme/search.html:21: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
  {% endblock %}
done
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 19 warnings.

The HTML pages are in _build/html.

I think this is because Sphinx cannot handle the content I put in the plantuml file.我认为这是因为Sphinx无法处理我放入plantuml文件的内容。

How can I include the plantuml file so it works如何包含plantuml文件以使其正常工作

包含外部文件不应该如下所示吗?

.. uml:: composite.puml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Sphinx 和 reStructuredText:在 include 指令中传递参数 - Sphinx and reStructuredText: pass parameter in include directive 如何使用 Sphinx 在 reStructuredText 中添加博客样式标签 - How to add blog style tags in reStructuredText with Sphinx 无法以我想要的格式在reStructuredtext(Sphinx / readthedocs)中创建项目符号列表? - Can't make a bullet list in reStructuredtext (Sphinx/readthedocs) in the format that I want? reStructuredText / Sphinx 中的图像网格 - Image grid in reStructuredText / Sphinx 我可以将“Smartypants”添加到restructuredText吗? - Can I add “Smartypants” to restructuredText? 如何将reStructuredText代码块与Regex和Python匹配? - How can I match a reStructuredText code block with Regex and Python? 使用Sphinx转换为HTML时如何在reStructuredText中转义单引号 - How to escape single quotes in reStructuredText when converting to HTML using Sphinx 如何使用 Sphinx 和 reStructuredText 从 Python 打印行打印“撇号”? - How to print an 'Apostrophe' from a Python print line using Sphinx and reStructuredText? 如何在 markdown 文件中为 Sphinx 使用 automodule 或 autoclass? - How can I use automodule or autoclass for Sphinx in a markdown file? 如何从我的Python模块中使sphinx-quickstart自动包含docstrings - How can I make sphinx-quickstart auto-include docstrings from my Python modules
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM