Georg Brandl avatar Georg Brandl committed 714c805

#21: allow short form for seealso arguments.

Comments (0)

Files changed (5)

   - Lists enumerated by letters or roman numerals are now handled like in
     standard reST.
+  - The ``seealso`` directive can now also be given arguments, as a short
+    form.
 * HTML output and templates:
   - Incompatible change: The "root" relation link (top left in the


          `GNU tar manual, Basic Tar Format <http://link>`_
             Documentation for tar archive files, including GNU tar extensions.
+   There's also a "short form" allowed that looks like this::
+      .. seealso:: modules :mod:`zipfile`, :mod:`tarfile`
+   .. versionadded:: 0.5
+      The short form.
 .. directive:: .. rubric:: title
    This directive creates a paragraph heading that is not used to create a


 def seealso_directive(name, arguments, options, content, lineno,
                       content_offset, block_text, state, state_machine):
-    rv = make_admonition(
+    seealsonode = make_admonition(
         addnodes.seealso, name, [_('See also')], options, content,
         lineno, content_offset, block_text, state, state_machine)
-    return rv
+    if arguments:
+        argnodes, msgs = state.inline_text(arguments[0], lineno)
+        para = nodes.paragraph()
+        para += argnodes
+        seealsonode[1:1] = [para] + msgs
+    return [seealsonode]
 seealso_directive.content = 1
-seealso_directive.arguments = (0, 0, 0)
+seealso_directive.arguments = (0, 1, 1)
 directives.register_directive('seealso', seealso_directive)


             classes = ['admonition-' + nodes.make_id(title_text)]
         admonition_node['classes'] += classes
     state.nested_parse(content, content_offset, admonition_node)
-    return [admonition_node]
+    return admonition_node


 Reference lookup: [Ref1]_ (defined in another file).
-.. seealso::
+.. seealso:: something, something else, something more
    `Google <>`_
        For everything.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.