Changeset 16525
- Timestamp:
- Apr 16, 2017, 2:00:00 AM (8 years ago)
- Location:
- pydocplugin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pydocplugin/0.10/tracpydoc/tracpydoc.py
r2010 r16525 43 43 _cleanup_inline_re = re.compile(r'<a href=".">index</a>(?:<br>)?|' 44 44 r'<a href="file:.*?</a>(?:<br>)?') 45 45 46 46 def __init__(self, env): 47 47 self.env = env … … 89 89 return '<a href="%s">%s</a>' % \ 90 90 (self.env.href.pydoc(target).encode('utf-8'), label or target) 91 91 92 92 def modulelink(self, obj): 93 93 return self._pydoc_link(obj.__name__) … … 123 123 return re.sub(self._cleanup_heading_re, r'href="\1"', 124 124 self._cleanup('heading', *args)) 125 125 126 126 def section(self, *args): 127 127 return self._cleanup('section', *args) … … 131 131 132 132 def _cleanup(self, kind, *args): 133 return re.sub(self._cleanup_inline_re, '', 133 return re.sub(self._cleanup_inline_re, '', 134 134 re.sub(self._cleanup_re, 'class="pydoc%s"' % kind, 135 135 getattr(pydoc.HTMLDoc, kind)(self, *args))) 136 136 137 137 138 138 class PyDoc(Component): … … 270 270 finally: 271 271 self.makedoc_lock.release() 272 272 273 273 # INavigationContributor methods 274 274 275 275 def get_active_navigation_item(self, req): 276 276 return 'pydoc' 277 277 278 278 def get_navigation_items(self, req): 279 279 yield 'mainnav', 'pydoc', html.A('PyDoc', href= req.href.pydoc()) 280 280 281 281 # IRequestHandler methods 282 282 283 283 def match_request(self, req): 284 284 return req.path_info.startswith('/pydoc') … … 288 288 target = req.path_info[7:] 289 289 req.hdf['trac.href.pydoc'] = req.href.pydoc() 290 req.hdf['pydoc.trail'] = [Markup(to_unicode(x)) for x in 290 req.hdf['pydoc.trail'] = [Markup(to_unicode(x)) for x in 291 291 self.doc._path_links(target)[:-1]] 292 292 req.hdf['pydoc.trail_last'] = target.split('.')[-1] … … 296 296 297 297 # ITemplateProvider methods 298 298 299 299 def get_templates_dirs(self): 300 300 from pkg_resources import resource_filename … … 341 341 An optional second argument (`visibility`) can be set in order 342 342 to control the type of documentation that will be shown: 343 * using "public", only show the documentation for exported symbols 343 * using "public", only show the documentation for exported symbols 344 344 * using "private", all the documentation will be shown 345 345 … … 358 358 def get_macro_description(self, name): 359 359 return self.__doc__ 360 360 361 361 def render_macro(self, req, name, content): 362 362 args = content.split(',') … … 395 395 pydoc.ModuleScanner().run(callback) 396 396 return results 397 -
pydocplugin/0.11/tracpydoc/tracpydoc.py
r2012 r16525 38 38 _cleanup_inline_re = re.compile(r'<a href=".">index</a>(?:<br>)?|' 39 39 r'<a href="file:.*?</a>(?:<br>)?') 40 40 41 41 def __init__(self, env): 42 42 self.env = env … … 84 84 return '<a href="%s">%s</a>' % \ 85 85 (self.env.href.pydoc(target).encode('utf-8'), label or target) 86 86 87 87 def modulelink(self, obj): 88 88 return self._pydoc_link(obj.__name__) … … 118 118 return re.sub(self._cleanup_heading_re, r'href="\1"', 119 119 self._cleanup('heading', *args)) 120 120 121 121 def section(self, *args): 122 122 return self._cleanup('section', *args) … … 126 126 127 127 def _cleanup(self, kind, *args): 128 return re.sub(self._cleanup_inline_re, '', 128 return re.sub(self._cleanup_inline_re, '', 129 129 re.sub(self._cleanup_re, 'class="pydoc%s"' % kind, 130 130 getattr(pydoc.HTMLDoc, kind)(self, *args))) 131 131 132 132 133 133 class PyDoc(Component): … … 265 265 finally: 266 266 self.makedoc_lock.release() 267 267 268 268 # INavigationContributor methods 269 269 270 270 def get_active_navigation_item(self, req): 271 271 return 'pydoc' 272 272 273 273 def get_navigation_items(self, req): 274 274 yield 'mainnav', 'pydoc', tag.a('PyDoc', href= req.href.pydoc()) 275 275 276 276 # IRequestHandler methods 277 277 278 278 def match_request(self, req): 279 279 return req.path_info.startswith('/pydoc') … … 282 282 add_stylesheet(req, 'pydoc/css/pydoc.css') 283 283 target = req.path_info[7:] 284 data = {'trail': [Markup(to_unicode(x)) for x in 284 data = {'trail': [Markup(to_unicode(x)) for x in 285 285 self.doc._path_links(target)], 286 286 'generate_help': self.generate_help, … … 289 289 290 290 # ITemplateProvider methods 291 291 292 292 def get_templates_dirs(self): 293 293 from pkg_resources import resource_filename … … 334 334 An optional second argument (`visibility`) can be set in order 335 335 to control the type of documentation that will be shown: 336 * using "public", only show the documentation for exported symbols 336 * using "public", only show the documentation for exported symbols 337 337 * using "private", all the documentation will be shown 338 338 … … 351 351 def get_macro_description(self, name): 352 352 return self.__doc__ 353 353 354 354 def render_macro(self, req, name, content): 355 355 args = content.split(',') … … 388 388 pydoc.ModuleScanner().run(callback) 389 389 return results 390
Note: See TracChangeset
for help on using the changeset viewer.