Changeset 3145 for trac/plugins
- Timestamp:
- 01/12/07 15:44:56 (6 years ago)
- Location:
- trac/plugins/tracnav-0.11
- Files:
-
- 3 edited
-
README (modified) (1 diff)
-
tracnav/__init__.py (modified) (1 diff)
-
tracnav/tracnav.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trac/plugins/tracnav-0.11/README
r3090 r3145 66 66 ------------------- 67 67 68 Copyright 2005, 2006 69 - Bernhard Haumacher (haui at haumacher.de) 70 - Thomas Moschny (moschny at ipd.uni-karlsruhe.de) 68 Copyright 2005-2006, Bernhard Haumacher (haui at haumacher.de) 69 Copyright 2005-2007, Thomas Moschny (moschny at ipd.uni-karlsruhe.de) 71 70 72 71 This program is free software; you can redistribute it and/or modify -
trac/plugins/tracnav-0.11/tracnav/__init__.py
r3142 r3145 1 __version__ = ' 3.92pre7'1 __version__ = '4.0pre1' -
trac/plugins/tracnav-0.11/tracnav/tracnav.py
r3142 r3145 34 34 == Author and License == 35 35 36 Copyright 2005, 2006 37 * Bernhard Haumacher (haui at haumacher.de) 38 * Thomas Moschny (moschny at ipd.uni-karlsruhe.de) 36 * Copyright 2005-2006, Bernhard Haumacher (haui at haumacher.de) 37 * Copyright 2005-2007, Thomas Moschny (moschny at ipd.uni-karlsruhe.de) 39 38 40 39 {{{ … … 77 76 last wiki link. 78 77 """ 78 def __init__(self, context): 79 OneLinerFormatter.__init__(self, context) 80 self.lastlink = None 81 79 82 def format_toc(self, wikitext): 80 self.l ink = None83 self.lastlink = None 81 84 out = StringIO() 82 85 OneLinerFormatter.format(self, wikitext, out) 83 return out.getvalue(), self.link 84 85 def __init__(self, env, req = None): 86 OneLinerFormatter.__init__(self, env) 87 # OneLinerFormatter sets req to None 88 self.req = req 89 self.link = None 86 return out.getvalue(), self.lastlink 90 87 91 88 def _make_link(self, namespace, target, match, label): 92 89 if namespace == 'wiki': 93 self.l ink = target90 self.lastlink = target 94 91 return OneLinerFormatter._make_link( 95 92 self, namespace, target, match, label) … … 97 94 def _macro_formatter(self, match, fullmatch): 98 95 name = fullmatch.group('macroname').lower() 99 if name == 'br': 100 return ' ' 101 elif name in ALLOWED_MACROS: 96 if name in ALLOWED_MACROS: 102 97 # leapfrog the OneLinerFormatter 103 98 return Formatter._macro_formatter(self, match, fullmatch) 104 99 else: 105 return '' 100 # use the OneLinerFormatter 101 return OneLinerFormatter._macro_formatter(self, match, fullmatch) 106 102 107 103 # FIXME: what about _make_relative_link() ? … … 111 107 class Invocation(object): 112 108 113 def __init__(self, env, req, args, out): 114 115 #save for later use 116 self.env = env 117 self.req = req 109 def __init__(self, formatter, args, out): 110 111 # save for later use 112 self.formatter = formatter 113 114 # shortcuts 115 self.env = formatter.env 116 self.req = formatter.req 117 118 # output 118 119 self.out = out 119 120 self.col = 0 120 121 121 # needed several times122 self.preview = req.args.get('preview', '')123 self.curpage = req.args.get('page', 'WikiStart')124 self.modify = req.perm.has_permission('WIKI_MODIFY')122 # needed several times 123 self.preview = self.req.args.get('preview', '') 124 self.curpage = self.req.args.get('page', 'WikiStart') 125 self.modify = self.req.perm.has_permission('WIKI_MODIFY') 125 126 126 127 # parse arguments … … 149 150 Parse and format the entries in toc_text. 150 151 """ 151 formatter = TocFormatter(self. env, self.req)152 formatter = TocFormatter(self.formatter.context) 152 153 for match in LISTRULE.finditer(toc_text): 153 154 indent = len(match.group('indent')) … … 298 299 yield 'JPNav' # legacy 299 300 300 def render_macro(self, req, name, args):301 def render_macro(self, formatter, name, args): 301 302 out = StringIO() 302 Invocation( self.env, req, args, out).run()303 Invocation(formatter, args, out).run() 303 304 return out.getvalue() 304 305
Note: See TracChangeset
for help on using the changeset viewer.
