[pypy-svn] pypy documentation-cleanup: make :config: roles work again

cfbolz commits-noreply at bitbucket.org
Tue Apr 26 18:15:26 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: documentation-cleanup
Changeset: r43640:ae024f6b7cc6
Date: 2011-04-26 18:14 +0200
http://bitbucket.org/pypy/pypy/changeset/ae024f6b7cc6/

Log:	make :config: roles work again

diff --git a/pypy/doc/pypyconfig.py b/pypy/doc/pypyconfig.py
new file mode 100644
--- /dev/null
+++ b/pypy/doc/pypyconfig.py
@@ -0,0 +1,9 @@
+
+
+def setup(app):
+    import sys, os
+    sys.path.append(os.path.abspath("../../"))
+    from pypy.config import makerestdoc
+    import py
+    role = makerestdoc.register_config_role(py.path.local())
+    app.add_role("config", role)

diff --git a/pypy/config/makerestdoc.py b/pypy/config/makerestdoc.py
--- a/pypy/config/makerestdoc.py
+++ b/pypy/config/makerestdoc.py
@@ -221,7 +221,7 @@
         from docutils import nodes
         from pypy.config.pypyoption import get_pypy_config
         from pypy.config.makerestdoc import get_cmdline
-        txt = docdir.join("config", text + ".txt")
+        txt = docdir.join("config", text + ".rst")
         html = docdir.join("config", text + ".html")
         assert txt.check()
         assert name == "config"
@@ -247,9 +247,8 @@
                     shortest_long_option = cmd
             text = shortest_long_option
         target = prefix + relative
-        print text, target
         reference_node = nodes.reference(rawtext, text, name=text, refuri=target)
         return [reference_node], []
     config_role.content = True
     config_role.options = {}
-    roles.register_canonical_role("config", config_role)
+    return config_role

diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -16,13 +16,13 @@
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.append(os.path.abspath('.'))
+sys.path.append(os.path.abspath('.'))
 
 # -- General configuration -----------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', 'sphinx.ext.graphviz']
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', 'sphinx.ext.graphviz', 'pypyconfig']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -196,3 +196,4 @@
 
 # Example configuration for intersphinx: refer to the Python standard library.
 intersphinx_mapping = {'http://docs.python.org/': None}
+


More information about the Pypy-commit mailing list