From f2d6c6f54d3dc05a022ede85dc15462d5fb0ea09 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Wed, 27 Oct 2010 16:10:48 +0000 Subject: [1.2.X] Documented options accepted by the runfcgi management command. Also, modified our custom management command option docs xref parser to also process those without a ``--`` prefix. -- Refs #14398. Backport of [14361] from trunk git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14363 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/_ext/djangodocs.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'docs/_ext') diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py index 325ed76cdc..022ec3acd3 100644 --- a/docs/_ext/djangodocs.py +++ b/docs/_ext/djangodocs.py @@ -2,6 +2,7 @@ Sphinx plugins for Django documentation. """ import os +import re from docutils import nodes, transforms try: @@ -21,6 +22,9 @@ from sphinx.writers.html import SmartyPantsHTMLTranslator from sphinx.util.console import bold from sphinx.util.compat import Directive +# RE for option descriptions without a '--' prefix +simple_option_desc_re = re.compile( + r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') def setup(app): app.add_crossref_type( @@ -207,6 +211,16 @@ def parse_django_adminopt_node(env, sig, signode): if not count: firstname = optname count += 1 + if not count: + for m in simple_option_desc_re.finditer(sig): + optname, args = m.groups() + if count: + signode += addnodes.desc_addname(', ', ', ') + signode += addnodes.desc_name(optname, optname) + signode += addnodes.desc_addname(args, args) + if not count: + firstname = optname + count += 1 if not firstname: raise ValueError return firstname -- cgit v1.3