notes/trac: traccollapsible-my.diff
File traccollapsible-my.diff, 1.1 KB (added by root, at 2015-05-14T11:04:01Z) |
---|
-
collapsible.py
old new 1 # Copyright 2010 Matthew Noyes <thecodingking at gmail.com> 1 # Copyright 2010 Matthew Noyes <thecodingking at gmail.com> 2 2 # 3 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 4 # you may not use this file except in compliance with the License. … … 24 24 class CollapsibleStartMacro(WikiMacroBase): 25 25 r"""CollapsibleStartMacro marks the start of a collapsible list 26 26 27 Example: 27 Example: 28 28 `[[CollapsibleStart(Title)]]` 29 29 """ 30 30 31 31 def expand_macro(self, formatter, name, content): 32 32 33 33 # process arguments 34 34 args, kw = parse_args(content) 35 tag = 'span' 35 36 title = '' 36 37 37 for i in range(0, len(args)): 38 title += args[i] 38 if len(args) > 0: 39 title = args[0] 40 if len(args) > 1: 41 tag = args[1] 39 42 40 43 return("<div> " + 41 "< h3 class=\"foldable\">" + title + "</h3>" +44 "<" + tag + " class=\"foldable\">" + title + "</" + tag + ">" + 42 45 "<div>") 43 46 44 47