Ticket #780: doxygen_namemangling.patch

File doxygen_namemangling.patch, 2.3 kB (added by Giel van Schijndel <me@mortis.eu>, 6 months ago)

Unified diff version of ticket:780:doxygen_namespace.diff

  • 0.10/doxygentrac/doxygentrac.py

    old new  
    6868    encoding = Option('doxygen', 'encoding', 'iso-8859-1', 
    6969      """Default encoding used by the generated documentation files.""") 
    7070 
     71    default_namespace = Option('doxygen', 'default_namespace', '', 
     72      """Default namespace to search for named objects in.""") 
     73 
    7174    SUMMARY_PAGES = """ 
    7275    annotated classes dirs files functions globals hierarchy 
    7376    index inherits main namespaces namespacemembers 
     
    318321        #  - do something about dirs 
    319322        #  - expand with enum, defs, etc. 
    320323        #  - this doesn't work well with the CREATE_SUBDIRS Doxygen option 
    321         path, link = lookup('class%s.html' % file, 'class') 
     324 
     325        # do doxygen-style name->file mapping 
     326        # this is a little different than doxygen, but I don't see another way 
     327        # way to make doxygen:Type<bool> links work, as it inserts a ' ' (or 
     328        # '_01') after/before the type name. 
     329        charmap = { '_':'__', ':':'_1', '/':'_2', '<':'_3_01', '>':'_01_4', \ 
     330                    '*':'_5', '&':'_6', '|':'_7', '.':'_8', '!':'_9', \ 
     331                    ',':'_00',' ':'_01' } 
     332        mangledfile = '' 
     333        for i in file: 
     334            if i in charmap.keys(): 
     335                mangledfile += charmap[i] 
     336            else: 
     337                mangledfile += i 
     338 
     339        path, link = lookup('class%s.html' % mangledfile, 'class') 
    322340        if not path: 
    323             path, link = lookup('struct%s.html' % file, 'struct') 
     341            path, link = lookup('struct%s.html' % mangledfile, 'struct') 
    324342        if path: 
    325343            return 'view', path, link 
    326344 
     345        # Try in the default_namespace 
     346        if self.default_namespace != "": 
     347            mangledfile = self.default_namespace + '_1_1' + mangledfile 
     348            path, link = lookup('class%s.html' % mangledfile, 'class') 
     349            if not path: 
     350                path, link = lookup('struct%s.html' % mangledfile, 'struct') 
     351            if path: 
     352                return 'view', path, link 
     353 
     354 
    327355        # Revert to search... 
    328356        results = self._search_in_documentation(doc, [file]) 
    329357        class_ref = file+' Class Reference'