summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/conf.py5
-rw-r--r--doc/src/extras.rst2
-rw-r--r--doc/src/index.rst1
-rw-r--r--doc/src/news.rst4
-rw-r--r--doc/src/tools/lib/ticket_role.py39
5 files changed, 50 insertions, 1 deletions
diff --git a/doc/src/conf.py b/doc/src/conf.py
index e181b5b..5937a7b 100644
--- a/doc/src/conf.py
+++ b/doc/src/conf.py
@@ -26,7 +26,7 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.ifconfig',
'sphinx.ext.doctest', 'sphinx.ext.intersphinx' ]
# Specific extensions for Psycopg documentation.
-extensions += [ 'dbapi_extension', 'sql_role' ]
+extensions += [ 'dbapi_extension', 'sql_role', 'ticket_role' ]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -65,6 +65,9 @@ intersphinx_mapping = {
'py3': ('http://docs.python.org/3.2', None),
}
+# Pattern to generate links to the bug tracker
+ticket_url = 'http://psycopg.lighthouseapp.com/projects/62710/tickets/%s'
+
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
diff --git a/doc/src/extras.rst b/doc/src/extras.rst
index 39aa5f0..7354a09 100644
--- a/doc/src/extras.rst
+++ b/doc/src/extras.rst
@@ -373,6 +373,8 @@ requires no adapter registration.
List of component type oids of the type to be casted.
+.. _adapt-range:
+
.. index::
pair: range; Data types
diff --git a/doc/src/index.rst b/doc/src/index.rst
index 53980e4..595c236 100644
--- a/doc/src/index.rst
+++ b/doc/src/index.rst
@@ -54,6 +54,7 @@ Psycopg 2 is both Unicode and Python 3 friendly.
extras
errorcodes
faq
+ news
.. ifconfig:: builder != 'text'
diff --git a/doc/src/news.rst b/doc/src/news.rst
new file mode 100644
index 0000000..d5b11a6
--- /dev/null
+++ b/doc/src/news.rst
@@ -0,0 +1,4 @@
+Release notes
+=============
+
+.. include:: ../../NEWS
diff --git a/doc/src/tools/lib/ticket_role.py b/doc/src/tools/lib/ticket_role.py
new file mode 100644
index 0000000..f8ceea1
--- /dev/null
+++ b/doc/src/tools/lib/ticket_role.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+"""
+ ticket role
+ ~~~~~~~~~~~
+
+ An interpreted text role to link docs to lighthouse issues.
+
+ :copyright: Copyright 2013 by Daniele Varrazzo.
+"""
+
+from docutils import nodes, utils
+from docutils.parsers.rst import roles
+
+def ticket_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ try:
+ num = int(text.replace('#', ''))
+ except ValueError:
+ msg = inliner.reporter.error(
+ "ticket number must be... a number, got '%s'" % text)
+ prb = inliner.problematic(rawtext, rawtext, msg)
+ return [prb], [msg]
+
+ url_pattern = inliner.document.settings.env.app.config.ticket_url
+ if url_pattern is None:
+ msg = inliner.reporter.warning(
+ "ticket not configured: please configure ticket_url in conf.py")
+ prb = inliner.problematic(rawtext, rawtext, msg)
+ return [prb], [msg]
+
+ url = url_pattern % num
+ roles.set_classes(options)
+ node = nodes.reference(rawtext, 'ticket ' + utils.unescape(text),
+ refuri=url, **options)
+ return [node], []
+
+def setup(app):
+ app.add_config_value('ticket_url', None, 'env')
+ app.add_role('ticket', ticket_role)
+