Changeset 1249

Show
Ignore:
Timestamp:
09/05/06 09:34:07 (2 years ago)
Author:
cboos
Message:

DoxygenPlugin:

Added the html_output configuration setting, to better cope with the corresponding HTML_OUTPUT configuration setting of Doxygen, when there are multiple documentation projects.

Fixed the lookup, but probably more cleanups are still needed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doxygenplugin/0.10/doxygentrac/doxygentrac.py

    r1245 r1249  
    4444      for documentation files.""") 
    4545 
     46    html_output = Option('doxygen', 'html_output', None, 
     47      """Default documentation project suffix, as generated by Doxygen 
     48      using the HTML_OUTPUT Doxygen configuration setting.""") 
     49 
    4650    title = Option('doxygen', 'title', 'Doxygen', 
    4751      """Title to use for the main navigation tab.""") 
     
    9094    def match_request(self, req): 
    9195        if re.match(r'^/doxygen(?:$|/)', req.path_info): 
    92             segments = filter(None, req.path_info.split('/')) 
    93             segments = segments[1:] # ditch 'doxygen' 
    94             action, path, link = self._doxygen_lookup(segments) 
    95             req.args['action'] = action 
    96             if action == 'search' and link: 
    97                 req.args['query'] = link 
    98             elif action == 'redirect': 
    99                 req.args['link'] = link 
    100             req.args['path'] = path 
     96            if 'path' not in req.args: # not coming from a `doxygen:` link 
     97                segments = filter(None, req.path_info.split('/')) 
     98                segments = segments[1:] # ditch 'doxygen' 
     99                if segments: 
     100                    action, path, link = self._doxygen_lookup(segments) 
     101                    if action == 'search' and link: 
     102                        req.args['query'] = link 
     103                    elif action == 'redirect': 
     104                        req.args['link'] = link 
     105                else: 
     106                    action, path = 'index', '' 
     107                req.args['action'] = action 
     108                req.args['path'] = path 
    101109            return True 
    102110             
     
    196204    def get_link_resolvers(self): 
    197205        def doxygen_link(formatter, ns, params, label): 
    198             action, path, link = self._doxygen_lookup(params.split('/')) 
     206            if '/' not in params: 
     207                params = self.default_doc+'/'+params 
     208            segments = params.split('/') 
     209            if self.html_output: 
     210                segments[-1:-1] = [self.html_output] 
     211            action, path, link = self._doxygen_lookup(segments) 
    199212            if action == 'index': 
    200213                return html.a(label, title=self.title, 
    201214                              href=formatter.href.doxygen()) 
    202             if action == 'redirect'
    203                 if path: 
    204                     return html.a(label, title="Search result for "+params, 
    205                                   href=formatter.href.doxygen(path=path)+link) 
    206                 else: 
    207                     action = 'view' 
    208             if action in ('view', 'index')
     215            if action == 'redirect' and path
     216                return html.a(label, title="Search result for "+params, 
     217                              href=formatter.href.doxygen(link,path=path)) 
     218            if action == 'search': 
     219                return html.a(label, title=params, class_='missing', 
     220                              href=formatter.href.doxygen()) 
     221            else
    209222                return html.a(label, title=params, 
    210223                              href=formatter.href.doxygen(link, path=path)) 
    211             else: 
    212                 return html.a(label, title=params, class_='missing', 
    213                               href=formatter.href.doxygen()) 
    214224        yield ('doxygen', doxygen_link) 
    215225 
     
    222232        """Try to interpret path components as a request for doxygen targets 
    223233 
    224         Return an `(action,path,link)` pair, where: 
     234        Return an `(action,path,link)` tuple, where: 
    225235         - `action` describes what should be done (one of 'view', 
    226            'search' or 'index'), 
     236           'redirect', or 'search'), 
    227237         - `path` is the location on disk of the resource. 
    228238         - `link` is the link to the resource, relative to the 
     
    237247        else: 
    238248            if self.default_doc: # we can't stay at the 'doxygen/' level 
    239                 return 'redirect', None, \ 
    240                        self.default_doc + '/' + (file or self.index) 
     249                return 'redirect', None, '/'.join([self.default_doc, 
     250                                                   self.html_output, 
     251                                                   file or self.index]) 
    241252            else: 
    242253                doc = '' 
     
    245256            """Build (full path, relative link) and check if path exists.""" 
    246257            path = os.path.join(self.base_path, doc, file) 
    247             self.log.debug('%s file "%s" (at %s)' % (category, file, path)) 
    248             return os.path.exists(path) and path, doc + '/' + file 
    249  
    250         self.log.debug('looking up "%s" in documentation "%s"' % (file, doc)) 
     258            existing_path = os.path.exists(path) and path 
     259            link = doc+'/'+file 
     260            self.log.debug(' %s file %s' % (category, existing_path or 
     261                                            path+" (not found)")) 
     262            return existing_path, link 
     263 
     264        self.log.debug('Looking up "%s" in documentation "%s"' % (file, doc)) 
    251265 
    252266        # Direct request for searching 
     
    305319                path, link = lookup(url) 
    306320                if path: 
    307                     return 'redirect', path, target 
     321                    return 'redirect', path, link # target # FIXME 
    308322        self.log.debug('%s not found in %s' % (file, doc)) 
    309323        return 'search', None, file