Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
looyolo
scrapy
提交
5753e498
S
scrapy
项目概览
looyolo
/
scrapy
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
scrapy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5753e498
编写于
5月 09, 2015
作者:
E
Elias Dorneles
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes referencing, and list only settings not documented in current document
上级
d1053d2a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
20 deletion
+40
-20
docs/_ext/scrapydocs.py
docs/_ext/scrapydocs.py
+30
-18
docs/topics/settings.rst
docs/topics/settings.rst
+10
-2
未找到文件。
docs/_ext/scrapydocs.py
浏览文件 @
5753e498
...
...
@@ -13,8 +13,24 @@ class SettingsListDirective(Directive):
return
[
settingslist_node
(
''
)]
def
is_setting_node
(
node
):
return
node
.
tagname
==
'pending_xref'
and
node
[
'reftype'
]
==
'setting'
def
is_setting_index
(
node
):
if
node
.
tagname
==
'index'
:
# index entries for setting directives look like:
# [(u'pair', u'SETTING_NAME; setting', u'std:setting-SETTING_NAME', '')]
entry_type
,
info
,
refid
,
_
=
node
[
'entries'
][
0
]
return
entry_type
==
'pair'
and
info
.
endswith
(
'; setting'
)
return
False
def
get_setting_target
(
node
):
# target nodes are placed next to the node in the doc tree
return
node
.
parent
[
node
.
parent
.
index
(
node
)
+
1
]
def
get_setting_name_and_refid
(
node
):
"""Extract setting name from directive index node"""
entry_type
,
info
,
refid
,
_
=
node
[
'entries'
][
0
]
return
info
.
replace
(
'; setting'
,
''
),
refid
def
collect_scrapy_settings_refs
(
app
,
doctree
):
...
...
@@ -23,29 +39,24 @@ def collect_scrapy_settings_refs(app, doctree):
if
not
hasattr
(
env
,
'scrapy_all_settings'
):
env
.
scrapy_all_settings
=
[]
for
node
in
doctree
.
traverse
(
is_setting_node
):
try
:
targetnode
=
node
.
parent
[
node
.
parent
.
index
(
node
)
-
1
]
if
not
isinstance
(
targetnode
,
nodes
.
target
):
raise
IndexError
except
IndexError
:
targetid
=
"setting-%d"
%
env
.
new_serialno
(
'setting'
)
targetnode
=
nodes
.
target
(
''
,
''
,
ids
=
[
targetid
])
node
.
replace_self
([
targetnode
,
node
])
for
node
in
doctree
.
traverse
(
is_setting_index
):
targetnode
=
get_setting_target
(
node
)
assert
isinstance
(
targetnode
,
nodes
.
target
),
"Next node is not a target"
setting_name
,
refid
=
get_setting_name_and_refid
(
node
)
env
.
scrapy_all_settings
.
append
({
'docname'
:
env
.
docname
,
'lineno'
:
node
.
line
,
'node'
:
node
.
deepcopy
(),
'target'
:
targetnode
,
'setting_name'
:
setting_name
,
'refid'
:
refid
,
})
def
make_setting_element
(
setting_data
,
app
,
fromdocname
):
text
=
nodes
.
Text
(
setting_data
[
'node'
].
astext
())
targetid
=
''
# TODO: resolve to a proper id
refnode
=
make_refnode
(
app
.
builder
,
fromdocname
,
setting_data
[
'docname'
],
targetid
,
text
)
todocname
=
setting_data
[
'docname'
],
targetid
=
setting_data
[
'refid'
],
child
=
nodes
.
Text
(
setting_data
[
'setting_name'
]))
p
=
nodes
.
paragraph
()
p
.
append
(
refnode
)
...
...
@@ -57,7 +68,8 @@ def replace_settingslist_nodes(app, doctree, fromdocname):
for
node
in
doctree
.
traverse
(
settingslist_node
):
node
.
replace_self
([
make_setting_element
(
d
,
app
,
fromdocname
)
for
d
in
env
.
scrapy_all_settings
])
for
d
in
env
.
scrapy_all_settings
if
fromdocname
!=
d
[
'docname'
]])
def
setup
(
app
):
app
.
add_crossref_type
(
...
...
docs/topics/settings.rst
浏览文件 @
5753e498
...
...
@@ -133,8 +133,6 @@ to any particular component. In that case the module of that component will be
shown, typically an extension, middleware or pipeline. It also means that the
component must be enabled in order for the setting to have any effect.
.. settingslist::
.. setting:: AWS_ACCESS_KEY_ID
AWS_ACCESS_KEY_ID
...
...
@@ -1017,6 +1015,16 @@ Default: ``"Scrapy/VERSION (+http://scrapy.org)"``
The default User-Agent to use when crawling, unless overridden.
Settings documented elsewhere:
------------------------------
The following settings are documented elsewhere, please check each specific
case to see how to enable and use them.
.. settingslist::
.. _Amazon web services: http://aws.amazon.com/
.. _breadth-first order: http://en.wikipedia.org/wiki/Breadth-first_search
.. _depth-first order: http://en.wikipedia.org/wiki/Depth-first_search
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录