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>
    22#
    33#   Licensed under the Apache License, Version 2.0 (the "License");
    44#   you may not use this file except in compliance with the License.
     
    2424class CollapsibleStartMacro(WikiMacroBase):
    2525    r"""CollapsibleStartMacro marks the start of a collapsible list
    2626
    27     Example:   
     27    Example:
    2828    `[[CollapsibleStart(Title)]]`
    2929     """
    30    
     30
    3131    def expand_macro(self, formatter, name, content):
    3232
    3333        # process arguments
    3434        args, kw = parse_args(content)
     35        tag = 'span'
    3536        title = ''
    3637
    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]
    3942
    4043        return("<div> " +
    41                "<h3 class=\"foldable\">" + title + "</h3>" +
     44               "<" + tag + " class=\"foldable\">" + title + "</" + tag + ">" +
    4245               "<div>")
    4346
    4447