Changeset 1130
- Timestamp:
- 08/17/06 09:04:18 (2 years ago)
- Files:
-
- doxygenplugin/0.9/doxygentrac/doxygentrac.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doxygenplugin/0.9/doxygentrac/doxygentrac.py
r1129 r1130 55 55 # Get config variables. 56 56 base_path = self.config.get('doxygen', 'path', '/var/lib/trac/doxygen') 57 default_ project = self.config.get('doxygen', 'default_project', '')57 default_doc = self.config.get('doxygen', 'default_documentation', '') 58 58 ext = self.config.get('doxygen', 'ext', 'htm html png') 59 59 ext = '|'.join(ext.split(' ')) … … 72 72 if not match.group(1) and not match.group(2): 73 73 # Request for documentation index. 74 req.args['path'] = os.path.join(base_path, default_ project)74 req.args['path'] = os.path.join(base_path, default_doc) 75 75 req.args['action'] = 'index' 76 76 else: 77 # Get projectand file from request.77 # Get doc and file from request. 78 78 if not match.group(2): 79 project = default_project79 doc = default_doc 80 80 file = match.group(1) 81 81 else: 82 project= match.group(1)82 doc = match.group(1) 83 83 file = match.group(2) 84 84 85 self.log.debug(' project: %s' % (project,))85 self.log.debug('documentation: %s' % (doc,)) 86 86 self.log.debug('file: %s' % (file,)) 87 87 … … 92 92 elif re.match(r'''^(.*)[.](%s)''' % (ext,), file): 93 93 # Request for documentation file. 94 path = os.path.join(base_path, project, file)94 path = os.path.join(base_path, doc, file) 95 95 self.log.debug('path: %s' % (path,)) 96 96 if os.path.exists(path): … … 105 105 if match: 106 106 # Request for source file documentation. 107 path = os.path.join(base_path, project, '%s_8%s.html'107 path = os.path.join(base_path, doc, '%s_8%s.html' 108 108 % (match.group(1), match.group(2))) 109 109 self.log.debug('path: %s' % (path,)) … … 116 116 117 117 else: 118 path = os.path.join(base_path, project, 'class%s.html'118 path = os.path.join(base_path, doc, 'class%s.html' 119 119 % (file,)) 120 120 if os.path.exists(path): … … 122 122 req.args['action'] = 'file' 123 123 else: 124 path = os.path.join(base_path, project,124 path = os.path.join(base_path, doc, 125 125 'struct%s.html' % (file,)) 126 126 if os.path.exists(path): … … 128 128 req.args['action'] = 'file' 129 129 else: 130 results = self._search_in_ project(project,130 results = self._search_in_documentation(doc, 131 131 [file]) 132 132 for result in results: 133 133 self.log.debug(result) 134 134 if result['name'] == file: 135 req.redirect(self.env.href.doxygen( 136 project)+ '/' + result['url'])135 req.redirect(self.env.href.doxygen(doc) 136 + '/' + result['url']) 137 137 req.args['action'] = 'search' 138 138 req.args['query'] = file … … 223 223 base_path = self.config.get('doxygen', 'path') 224 224 225 for projectin os.listdir(base_path):226 # Search in projectdocumentation directories227 path = os.path.join(base_path, project)225 for doc in os.listdir(base_path): 226 # Search in documentation directories 227 path = os.path.join(base_path, doc) 228 228 if os.path.isdir(path): 229 229 index = os.path.join(path, 'search.idx') 230 230 if os.path.exists(index): 231 231 creation = os.path.getctime(index) 232 for result in self._search_in_ project(project, keywords):233 result['url'] = self.env.href.doxygen( project) + '/' \232 for result in self._search_in_documentation(doc, keywords): 233 result['url'] = self.env.href.doxygen(doc) + '/' \ 234 234 + result['url'] 235 235 yield result['url'], result['name'], creation, \ … … 240 240 if os.path.exists(index): 241 241 creation = os.path.getctime(index) 242 for result in self._search_in_ project('', keywords):242 for result in self._search_in_documentation('', keywords): 243 243 result['url'] = self.env.href.doxygen() + '/' + \ 244 244 result['url'] … … 254 254 255 255 # internal methods 256 def _search_in_ project(self, project, keywords):257 # Open index file for projectdocumentation256 def _search_in_documentation(self, doc, keywords): 257 # Open index file for documentation 258 258 base_path = self.config.get('doxygen', 'path') 259 index = os.path.join(base_path, project, 'search.idx')259 index = os.path.join(base_path, doc, 'search.idx') 260 260 if os.path.exists(index): 261 261 fd = open(index)
