Changes between Version 16 and Version 17 of WikiTableMacro


Ignore:
Timestamp:
Dec 21, 2012, 12:19:01 PM (11 years ago)
Author:
Ryan J Ollos
Comment:

Patch moved to ticket #10723.

Legend:

Unmodified
Added
Removed
Modified
  • WikiTableMacro

    v16 v17  
    7878'''Maintainer:''' [wiki:rjollos] [[BR]]
    7979'''Contributors:'''
    80 
    81 -----
    82 == Some Patches ==
    83 I added below to render_macro to provide a rudimentary sort of variable function.
    84 
    85 
    86 {{{
    87     def render_macro(self, req, name, content):
    88 +        c = content.split("|;|")
    89 +        content = c[0]
    90 +        if len(c) > 1 :
    91 +                for i in c[1:] :
    92 +                        v = i.split("=")
    93 +                        if len(v) > 1 :
    94 +                                k = v[0]
    95 +                                v = v[1]
    96 +                                content = content.replace(k,v)
    97 }}}
    98 
    99 i.e. you can do something like this
    100 {{{
    101     {{{
    102     #!SQLTable
    103         SELECT "a", count($id) as 'Number of Tickets'
    104         FROM ticket
    105         UNION
    106         SELECT "b", count($id) as 'Number of Tickets'
    107         FROM ticket|;|$id=id
    108     }}}
    109 }}}
    110 Useful when you have the same id that you don't want to keep on retyping over.
    111 -----