我在使用sphinxcontrib-httpdomain时遇到问题。如果我定义http get或post或任何其他域,sphinx-build会告诉我有关错误的信息
未知指令类型" http:get"
我的来源中http:post domain的定义:
.. http:get:: /users/(int:user_id)/posts/(tag)
The posts tagged with `tag` that the user (`user_id`) wrote.
**Example request**:
.. sourcecode:: http
GET /users/123/posts/web HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
[
{
"post_id": 12345,
"author_id": 123,
"tags": ["server", "web"],
"subject": "I tried Nginx"
},
{
"post_id": 12346,
"author_id": 123,
"tags": ["html5", "standards", "web"],
"subject": "We go to HTML 5"
}
]
:query sort: one of ``hit``, ``created-at``
:query offset: offset number. default is 0
:query limit: limit number. default is 30
:reqheader Accept: the response content type depends on
:mailheader:`Accept` header
:reqheader Authorization: optional OAuth token to authenticate
:resheader Content-Type: this depends on :mailheader:`Accept`
header of request
:statuscode 200: no error
:statuscode 404: there's no user
此块之前和之后有两个空行。我试图使用3,4个空格并偏移块的内容
conf.py的扩展名块的内容:
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.doctest',
'sphinx.ext.graphviz',
'sphinxcontrib.httpdomain'
]
我也尝试过它并没有帮助: - 通过pip重新安装所有sphinx *包
通过apt-get
在conf.py中指定扩展名的路径
通过pip
构建另一台主机(同一错误)
使用-vvv模式查看构建日志
阅读[官方插件文档] [3]并执行所有步骤
一些有用的信息:
所有软件包都安装在/usr/local/lib/python2.7/dist-packages
pip show sphinx输出:
Name: Sphinx
Version: 1.6.7
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: georg@python.org
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: sphinxcontrib-websupport, babel, imagesize, setuptools, typing, Pygments, requests, six, docutils, alabaster, Jinja2, snowballstemmer
pip show sphinxcontrib-httpdomain输出:
Name: sphinxcontrib-httpdomain
Version: 1.6.0
Summary: Sphinx domain for documenting HTTP APIs
Home-page: https://github.com/sphinx-contrib/httpdomain
Author: Hong Minhee
Author-email: hong.minhee@gmail.com
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: six, Sphinx
uname输出:
Linux 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
答案 0 :(得分:0)
解决这个问题一段时间后,我终于找到了解决方案。 Debian buster和Ubuntu bionic(及更高版本)中包含的版本已添加了一个补丁程序,该补丁程序解决了一个问题,但增加了此问题。
该修补程序来自this commit,但缺少在this other commit中添加几天后的修补程序。
即使您尝试使用pip进行安装,您似乎仍在使用系统版本。您可以通过编辑$group
上的代码来对其进行简单修补。
我正在将补丁发送给软件包维护者,希望它很快会在不稳定的情况下得到修复。