aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-11-20 20:47:00 +0000
committerDavid Robillard <d@drobilla.net>2011-11-20 20:47:00 +0000
commit8b5258fb09a600d7171a11d6a7f0c1fef950147a (patch)
tree208c32912072e030e31a9d1340a99fbbd6fab3a1
parent4ff6c527a9feda500eff87beb4d92780eef2665b (diff)
downloadlv2-8b5258fb09a600d7171a11d6a7f0c1fef950147a.tar.xz
Functionify Doxygen tags stuff.
-rwxr-xr-xgendoc.py74
1 files changed, 38 insertions, 36 deletions
diff --git a/gendoc.py b/gendoc.py
index 2f6ae7e..3429f67 100755
--- a/gendoc.py
+++ b/gendoc.py
@@ -40,42 +40,44 @@ print('** Generating header documentation')
print(' * Calling doxygen in ' + os.getcwd())
subprocess.call('doxygen', stdout=devnull)
-
-# Rescue Doxygen tag file from XML hell
-
-# Return the content of the first child node with a certain tag name
-def getChildText(elt, tagname):
- elements = elt.getElementsByTagName(tagname)
- for e in elements:
- if e.parentNode == elt:
- return e.firstChild.nodeValue
- return ''
-
-tagdoc = xml.dom.minidom.parse('c_tags')
-root = tagdoc.documentElement
-bettertags = open(TAGFILE, 'w')
-for cn in root.childNodes:
- if cn.nodeType == xml.dom.Node.ELEMENT_NODE and cn.tagName == 'compound':
- if cn.getAttribute('kind') == 'page':
- continue
- name = getChildText(cn, 'name')
- filename = getChildText(cn, 'filename')
- # Sometimes the .html is there, sometimes it isn't...
- if filename[-5:] != '.html':
- filename += '.html'
- bettertags.write('%s %s%s\n' % (name, DOXPREFIX, filename))
- if cn.getAttribute('kind') == 'file':
- prefix = ''
- else:
- prefix = name + '::'
- members = cn.getElementsByTagName('member')
- for m in members:
- mname = prefix + getChildText(m, 'name')
- mafile = getChildText(m, 'anchorfile')
- manchor = getChildText(m, 'anchor')
- bettertags.write('%s %s%s#%s\n' % (mname, DOXPREFIX, \
- mafile, manchor))
-bettertags.close()
+def rescue_tags(in_path, out_path):
+ "Rescue Doxygen tag file from XML hell."
+
+ def getChildText(elt, tagname):
+ "Return the content of the first child node with a certain tag name."
+ elements = elt.getElementsByTagName(tagname)
+ for e in elements:
+ if e.parentNode == elt:
+ return e.firstChild.nodeValue
+ return ''
+
+ tagdoc = xml.dom.minidom.parse(in_path)
+ root = tagdoc.documentElement
+ bettertags = open(out_path, 'w')
+ for cn in root.childNodes:
+ if cn.nodeType == xml.dom.Node.ELEMENT_NODE and cn.tagName == 'compound':
+ if cn.getAttribute('kind') == 'page':
+ continue
+ name = getChildText(cn, 'name')
+ filename = getChildText(cn, 'filename')
+ # Sometimes the .html is there, sometimes it isn't...
+ if not filename.endswith('.html'):
+ filename += '.html'
+ bettertags.write('%s %s%s\n' % (name, DOXPREFIX, filename))
+ if cn.getAttribute('kind') == 'file':
+ prefix = ''
+ else:
+ prefix = name + '::'
+ members = cn.getElementsByTagName('member')
+ for m in members:
+ mname = prefix + getChildText(m, 'name')
+ mafile = getChildText(m, 'anchorfile')
+ manchor = getChildText(m, 'anchor')
+ bettertags.write('%s %s%s#%s\n' % (mname, DOXPREFIX, \
+ mafile, manchor))
+ bettertags.close()
+
+rescue_tags('c_tags', TAGFILE)
def subst_file(template, output, dict):
i = open(template, 'r')