带有狮身人面像的Robotframework文档

发布于 2025-02-13 09:18:26 字数 3004 浏览 0 评论 0原文

我在为狮身人面像的Robotframework资源创建自动文档时有很小的问题。

我找到了两个插件:

  • sphinxcontrib_robotdoc
  • sphinxcontrib_robotframework

但是sphinxcontrib_robotdoc是一个非常古老的解决方案,看起来像s ** t。因此,我想检查第二个解决方案,但它不起作用。

conf.py:

import os
import sys
sys.path.insert(0, os.path.abspath('../..'))


# -- Project information -----------------------------------------------------

project = 'example RF documentation'
author = 'CG'
release = '0.0.1'


# -- General configuration ---------------------------------------------------
extensions = ['sphinx.ext.autodoc',
              'm2r2',
              'autodocsumm',
              'sphinxcontrib_robotframework'
              ]

autodoc_default_flags = ['members', 'undoc-members', 'inherited-members']
autodoc_default_options = {
    'autosummary': True,
}

source_suffix = ['.rst', '.md']

templates_path = ['_templates']

exclude_patterns = []


sphinxcontrib_robotframework_enabled = True
sphinxcontrib_robotframework_quiet = True
sphinxcontrib_robotframework_variables = {
    "VARIABLE": "value"
}

# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_rtd_theme'
master_doc = 'index'

index.rst:

example RF documentation
============================
.. toctree::
   :caption: Table of content
   :maxdepth: 3
   :glob:

   interfaces/*
   changelog/*
   example/*

interface.rst:

example RF documentation
============================
Keywords
********
.. automodule:: example_rf_docu
   :members:
   :inherited-members:
   :undoc-members:
.. code:: robotframework

creating documentation command:

sphinx-build -b html /home/ute/repo/example_rf_docu/docs/source/ /home/ute/repo/example_rf_docu/doc_files/

command output:

Running Sphinx v4.1.2
WARNING: while setting up extension sphinxcontrib_robotframework: directive 'code' is already registered, it will be overridden
loading pickled environment... done
[autosummary] generating autosummary for: changelog/changelog.rst, example/example.rst, index.rst, interfaces/interface.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded, 1 warning.

The HTML pages are in doc_files.

In output we can see [autosummary]生成自室的for:changeLog/changelog.rst,示例/示例.rst,index.rst,Interfaces/Interfaces/interface.rst,列表中的每个页面都是正确生成的:

  • index:index:外观:外观:外观好(一切看起来都像我计划),
  • ChangElog:看起来不错(基于整个项目的Changelog生成页面),
  • 例如:看起来不错(它是空的,因为我还没有添加任何示例)
  • 接口:看起来错了,因为仅包含有关成员,继承的会员和Undoc-Members的信息主项目目录),并且不包含来自项目的任何RobotFramework文件的RobotFramework关键字的信息。那是我的小问题。

任何想法我能改善这一点并使其起作用。

I have small issue with creating automatic documentation for RobotFramework resources in Sphinx.

I've found two plugins:

  • sphinxcontrib_robotdoc,
  • sphinxcontrib_robotframework.

But sphinxcontrib_robotdoc is a very old solution and looks like s**t. So I want to check the second solution but it doesn't work.

conf.py:

import os
import sys
sys.path.insert(0, os.path.abspath('../..'))


# -- Project information -----------------------------------------------------

project = 'example RF documentation'
author = 'CG'
release = '0.0.1'


# -- General configuration ---------------------------------------------------
extensions = ['sphinx.ext.autodoc',
              'm2r2',
              'autodocsumm',
              'sphinxcontrib_robotframework'
              ]

autodoc_default_flags = ['members', 'undoc-members', 'inherited-members']
autodoc_default_options = {
    'autosummary': True,
}

source_suffix = ['.rst', '.md']

templates_path = ['_templates']

exclude_patterns = []


sphinxcontrib_robotframework_enabled = True
sphinxcontrib_robotframework_quiet = True
sphinxcontrib_robotframework_variables = {
    "VARIABLE": "value"
}

# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_rtd_theme'
master_doc = 'index'

index.rst:

example RF documentation
============================
.. toctree::
   :caption: Table of content
   :maxdepth: 3
   :glob:

   interfaces/*
   changelog/*
   example/*

interface.rst:

example RF documentation
============================
Keywords
********
.. automodule:: example_rf_docu
   :members:
   :inherited-members:
   :undoc-members:
.. code:: robotframework

creating documentation command:

sphinx-build -b html /home/ute/repo/example_rf_docu/docs/source/ /home/ute/repo/example_rf_docu/doc_files/

command output:

Running Sphinx v4.1.2
WARNING: while setting up extension sphinxcontrib_robotframework: directive 'code' is already registered, it will be overridden
loading pickled environment... done
[autosummary] generating autosummary for: changelog/changelog.rst, example/example.rst, index.rst, interfaces/interface.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded, 1 warning.

The HTML pages are in doc_files.

In output we can see
[autosummary] generating autosummary for: changelog/changelog.rst, example/example.rst, index.rst, interfaces/interface.rst and it's true every page from the list is generated properly:

  • index: looks good (everything looks like I've planned),
  • changelog: looks good (generate page based on changelog of whole project),
  • example: looks good (it's empty because I haven't added any examples)
  • interfaces: looks wrong, because contains only information about members, inherited-members and undoc-members like i set in interface.rst for whole project (init.py in main project directory) and contains no information about RobotFramework keywords from any RobotFramework file from project. And that's my small issue.

Any ideas what can I improve this and make it work.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文