Changeset 1249
- Timestamp:
- 09/05/06 09:34:07 (2 years ago)
- Files:
-
- doxygenplugin/0.10/doxygentrac/doxygentrac.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doxygenplugin/0.10/doxygentrac/doxygentrac.py
r1245 r1249 44 44 for documentation files.""") 45 45 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 46 50 title = Option('doxygen', 'title', 'Doxygen', 47 51 """Title to use for the main navigation tab.""") … … 90 94 def match_request(self, req): 91 95 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 101 109 return True 102 110 … … 196 204 def get_link_resolvers(self): 197 205 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) 199 212 if action == 'index': 200 213 return html.a(label, title=self.title, 201 214 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: 209 222 return html.a(label, title=params, 210 223 href=formatter.href.doxygen(link, path=path)) 211 else:212 return html.a(label, title=params, class_='missing',213 href=formatter.href.doxygen())214 224 yield ('doxygen', doxygen_link) 215 225 … … 222 232 """Try to interpret path components as a request for doxygen targets 223 233 224 Return an `(action,path,link)` pair, where:234 Return an `(action,path,link)` tuple, where: 225 235 - `action` describes what should be done (one of 'view', 226 ' search' or 'index'),236 'redirect', or 'search'), 227 237 - `path` is the location on disk of the resource. 228 238 - `link` is the link to the resource, relative to the … … 237 247 else: 238 248 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]) 241 252 else: 242 253 doc = '' … … 245 256 """Build (full path, relative link) and check if path exists.""" 246 257 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)) 251 265 252 266 # Direct request for searching … … 305 319 path, link = lookup(url) 306 320 if path: 307 return 'redirect', path, target321 return 'redirect', path, link # target # FIXME 308 322 self.log.debug('%s not found in %s' % (file, doc)) 309 323 return 'search', None, file
