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

问题描述 投票:0回答:1

我有一个plantuml文件composite.puml,具有以下内容:

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

而且我尝试将其包含在reStructuredText文档中(使用sphinxcontrib.plantuml插件):

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

但是运行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.

我认为这是因为Sphinx无法处理我放入plantuml文件中的内容。

我如何包含plantuml文件,以便它可以工作

我有一个具有以下内容的plantuml文件Composite.puml:包Composite {类Letter {+ __init __(char:str)#print_this_before()}并且我尝试将其包括在...

python python-sphinx restructuredtext plantuml
1个回答
0
投票

不应该像下面这样包含外部文件吗?

© www.soinside.com 2019 - 2024. All rights reserved.