-def trim(docstring):
- if not docstring:
- return ''
- # Convert tabs to spaces (following the normal Python rules)
- # and split into a list of lines:
- lines = docstring.expandtabs().splitlines()
- # Determine minimum indentation (first line doesn't count):
- indent = sys.maxint
- for line in lines[1:]:
- stripped = line.lstrip()
- if stripped:
- indent = min(indent, len(line) - len(stripped))
- # Remove indentation (first line is special):
- trimmed = [lines[0].strip()]
- if indent < sys.maxint:
- for line in lines[1:]:
- trimmed.append(line[indent:].rstrip())
- # Strip off trailing and leading blank lines:
- while trimmed and not trimmed[-1]:
- trimmed.pop()
- while trimmed and not trimmed[0]:
- trimmed.pop(0)
- # Return a single string:
- return '\n'.join(trimmed)
+tags = None
+linkbase = None
+
+def format_doxygrouplink(string, link=None):
+ global tags
+ if link == None:
+ link = string
+ if tags == None:
+ return string
+ e = tags.xpath("//compound[name/text()='%s']" % link)
+ if len(e) == 0:
+ return string
+ e = e[0]
+ anchorfile = e.xpath("filename/text()")
+ if len(anchorfile) == 0:
+ return string
+ global linkbase
+ return "<a href=\"%s%s\">%s</a>" % (linkbase, anchorfile[0], string)
+
+def format_doxylink(string, link=None):
+ global tags
+ if link == None:
+ link = string
+ if tags == None:
+ return string
+ e = tags.xpath("//member[name/text()='%s']" % link)
+ if len(e) == 0:
+ return string
+ e = e[0]
+ anchorfile = e.xpath("anchorfile/text()")
+ anchor = e.xpath("anchor/text()")
+ if len(anchorfile) == 0 or len(anchor) == 0:
+ return string
+ global linkbase
+ return "<a href=\"%s%s#%s\">%s</a>" % (linkbase, anchorfile[0], anchor[0], string)