Go to the documentation of this file.00001
00002
00003
00004
00005
00006 """
00007 DOXYTAG parses doxygen.tag files.
00008 """
00009
00010 import xml.dom.minidom
00011 import sys
00012 import os
00013 import re
00014
00015 __mpname__ = 'Doxytag'
00016 __version__ = '0.1'
00017 __date__ = '2013-07-09'
00018 __description__ = 'Doxygen tags parser'
00019 __long_description__ = __doc__
00020 __license__ = 'BSD'
00021 __author__ = 'Andrea Vedaldi'
00022
00023
00024 class Doxytag:
00025
00026 """
00027 d = Doxytag(FILENAME)
00028 """
00029 def __init__ (self, filename):
00030 self.index = {}
00031 dom = xml.dom.minidom.parse(filename)
00032 self.xBuildIndex(dom)
00033
00034 def getText(self, nodelist):
00035 rc = []
00036 for node in nodelist:
00037 if node.nodeType == node.TEXT_NODE:
00038 rc.append(node.data)
00039 return ''.join(rc)
00040
00041 def xBuildIndex(self, node):
00042 if node.nodeType == node.ELEMENT_NODE:
00043 if node.tagName == "docanchor":
00044 anchor=self.getText(node.childNodes)
00045 filename=node.getAttribute("file")
00046 if os.path.splitext(filename)[1] != '.html':
00047 filename += '.html'
00048 self.index[anchor] = filename + "#" + anchor
00049
00050 filename = node.getElementsByTagName("filename")
00051 if filename.length > 0:
00052 name = node.getElementsByTagName("name")
00053 if name.length > 0:
00054 s1 = self.getText(name[0].childNodes)
00055 s2 = self.getText(filename[0].childNodes)
00056 if os.path.splitext(s2)[1] != '.html':
00057 s2 = s2 + '.html'
00058 self.index[s1] = s2
00059
00060 for x in node.childNodes:
00061 self.xBuildIndex(x)
00062
00063 def dump(self):
00064 for k in self.index:
00065 print "%40s -> %40s" % (k, self.index[k])
00066
00067 if __name__ == '__main__':
00068 d = Doxytag("doc/doxygen.tag")
00069 d.dump()