summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2018-09-27 07:14:06 -0500
committerJason Madden <jamadden@gmail.com>2018-09-27 07:14:06 -0500
commitde407e5f4beb88d9aeedebec6469ab44d88324ac (patch)
tree444de78c95a95e1ec6a71aa46c12690938421311
parente93f66b15cc0ebfe667da0d7e08e1621c931f437 (diff)
downloadzope-configuration-de407e5f4beb88d9aeedebec6469ab44d88324ac.tar.gz
Unify docs for docutils.rst/py back into .py
-rw-r--r--docs/api/docutils.rst29
-rw-r--r--src/zope/configuration/docutils.py34
2 files changed, 31 insertions, 32 deletions
diff --git a/docs/api/docutils.rst b/docs/api/docutils.rst
index b75830c..b556c6f 100644
--- a/docs/api/docutils.rst
+++ b/docs/api/docutils.rst
@@ -1,26 +1,5 @@
-:mod:`zope.configuration.docutils`
-==================================
+=============================
+ zope.configuration.docutils
+=============================
-.. module:: zope.configuration.docutils
-
-.. autofunction:: wrap
-
- Examples:
-
- .. doctest::
-
- >>> from zope.configuration.docutils import wrap
- >>> print(wrap('foo bar')[:-2])
- foo bar
- >>> print(wrap('foo bar', indent=2)[:-2])
- foo bar
- >>> print(wrap('foo bar, more foo bar', 10)[:-2])
- foo bar,
- more foo
- bar
- >>> print(wrap('foo bar, more foo bar', 10, 2)[:-2])
- foo bar,
- more foo
- bar
-
-.. autofunction:: makeDocStructures
+.. automodule:: zope.configuration.docutils
diff --git a/src/zope/configuration/docutils.py b/src/zope/configuration/docutils.py
index c2386c2..37b0060 100644
--- a/src/zope/configuration/docutils.py
+++ b/src/zope/configuration/docutils.py
@@ -26,7 +26,24 @@ para_sep = re.compile('\n{2,}')
whitespace = re.compile('[ \t\n\r]+')
def wrap(text, width=78, indent=0):
- """Makes sure that we keep a line length of a certain width.
+ """
+ Makes sure that we keep a line length of a certain width.
+
+ Examples:
+
+ >>> from zope.configuration.docutils import wrap
+ >>> print(wrap('foo bar')[:-2])
+ foo bar
+ >>> print(wrap('foo bar', indent=2)[:-2])
+ foo bar
+ >>> print(wrap('foo bar, more foo bar', 10)[:-2])
+ foo bar,
+ more foo
+ bar
+ >>> print(wrap('foo bar, more foo bar', 10, 2)[:-2])
+ foo bar,
+ more foo
+ bar
"""
paras = para_sep.split(text.strip())
@@ -54,15 +71,18 @@ def wrap(text, width=78, indent=0):
def makeDocStructures(context):
- """Creates two structures that provide a friendly format for
+ """
+ makeDocStructures(context) -> namespaces, subdirs
+
+ Creates two structures that provide a friendly format for
documentation.
- 'namespaces' is a dictionary that maps namespaces to a directives
- dictionary with the key being the name of the directive and the value is a
- tuple: (schema, handler, info).
+ *namespaces* is a dictionary that maps namespaces to a directives
+ dictionary with the key being the name of the directive and the
+ value is a tuple: (schema, handler, info).
- 'subdirs' maps a (namespace, name) pair to a list of subdirectives that
- have the form (namespace, name, schema, info).
+ *subdirs* maps a (namespace, name) pair to a list of subdirectives
+ that have the form (namespace, name, schema, info).
"""
namespaces = {}
subdirs = {}