Changeset 3266
- Timestamp:
- 11/05/08 12:43:12 (5 years ago)
- File:
-
- 1 edited
-
trac/plugins/tracnav-0.11/tracnav/tracnav.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trac/plugins/tracnav-0.11/tracnav/tracnav.py
r3262 r3266 70 70 TRACNAVHOME = "http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav" 71 71 LISTRULE = re.compile(r"^(?P<indent>[ \t\v]+)\* +(?P<rest>.*)$", re.M) 72 ALLOWED_MACROS = ["image"]73 72 74 73 … … 78 77 last wiki link. 79 78 """ 80 def __init__(self, env, ctx ):79 def __init__(self, env, ctx, allowed_macros=[]): 81 80 OneLinerFormatter.__init__(self, env, ctx) 82 81 self.lastlink = None 82 self.allowed_macros = allowed_macros 83 83 84 84 def format_toc(self, wikitext): … … 95 95 96 96 def _macro_formatter(self, match, fullmatch): 97 name = fullmatch.group('macroname') .lower()98 if name in ALLOWED_MACROS:97 name = fullmatch.group('macroname') 98 if name in self.allowed_macros: 99 99 # leapfrog the OneLinerFormatter 100 100 return Formatter._macro_formatter(self, match, fullmatch) … … 125 125 self.collapse = True 126 126 self.reorder = True 127 self.allowed_macros = 'Image' 127 128 if args: 128 for arg in map(lambda a: a.strip(), args.split('|')): 129 for arg, _, values in map(lambda s: s.partition('='), args.split('|')): 130 arg = arg.strip() 129 131 if arg == 'nocollapse': 130 132 self.collapse = False … … 133 135 elif arg == 'noreorder': 134 136 self.reorder = False 137 elif arg == 'allowed_macros': 138 self.allowed_macros = map(lambda s: s.strip(), values.split(',')) 135 139 else: 136 140 self.names.append(arg) … … 151 155 Parse and format the entries in toc_text. 152 156 """ 153 formatter = TocFormatter(self.env, self.ctx )157 formatter = TocFormatter(self.env, self.ctx, self.allowed_macros) 154 158 for match in LISTRULE.finditer(toc_text): 155 159 indent = len(match.group('indent'))
Note: See TracChangeset
for help on using the changeset viewer.
