[Epydoc-commits] SF.net SVN: epydoc: [1719] trunk/epydoc/src/epydoc/docwriter/xlink.py
Brought to you by:
edloper
|
From: <ed...@us...> - 2008-02-15 01:00:44
|
Revision: 1719
http://epydoc.svn.sourceforge.net/epydoc/?rev=1719&view=rev
Author: edloper
Date: 2008-02-14 17:00:39 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
- Added support for the syntax `name <target>` in xlink.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/xlink.py
Modified: trunk/epydoc/src/epydoc/docwriter/xlink.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/xlink.py 2008-02-14 22:25:14 UTC (rev 1718)
+++ trunk/epydoc/src/epydoc/docwriter/xlink.py 2008-02-15 01:00:39 UTC (rev 1719)
@@ -364,6 +364,8 @@
docutils = roles = nodes = utils = None
class Reader: settings_spec = ()
+_TARGET_RE = re.compile(r'^(.*?)\s*<(?:URI:|URL:)?([^<>]+)>$')
+
def create_api_role(name, problematic):
"""
Create and register a new role to create links for an API documentation.
@@ -384,13 +386,18 @@
if docutils is None:
raise AssertionError('requires docutils')
+ # Check if there's separate text & targets
+ m = _TARGET_RE.match(text)
+ if m: text, target = m.groups()
+ else: target = text
+
# node in monotype font
text = utils.unescape(text)
node = nodes.literal(rawtext, text, **options)
# Get the resolver from the register and create an url from it.
try:
- url = api_register[name].get_url(text)
+ url = api_register[name].get_url(target)
except IndexError, exc:
msg = inliner.reporter.warning(str(exc), line=lineno)
if problematic:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|