Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

added role to link to scrapy source code (not yet used)

Pablo Hoffman9016e7e99353
diff --git a/docs/_ext/scrapydocs.py b/docs/_ext/scrapydocs.py
index 3cc916972..6b1e6a9b4 100644
--- a/docs/_ext/scrapydocs.py
+++ b/docs/_ext/scrapydocs.py
@@ -1,3 +1,6 @@
+from docutils.parsers.rst.roles import set_classes
+from docutils import nodes
+
def setup(app):
app.add_crossref_type(
directivename = "setting",
@@ -19,3 +22,10 @@ def setup(app):
rolename = "reqmeta",
indextemplate = "pair: %s; reqmeta",
)
+ app.add_role('source', source_role)
+
+def source_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ url = 'http://dev.scrapy.org/browser/' + text
+ set_classes(options)
+ node = nodes.reference(rawtext, text, refuri=ref, **options)
+ return [node], []