Changes between Version 8 and Version 9 of WikiTableMacro


Ignore:
Timestamp:
Dec 23, 2010 6:22:30 PM (4 years ago)
Author:
pekcheey@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiTableMacro

    v8 v9  
    5858'''Maintainer:''' [wiki:rjollos] [[BR]] 
    5959'''Contributors:''' 
     60 
     61----- 
     62== Some Patches == 
     63I added below to render_macro to provide a rudimentary sort of variable function. 
     64 
     65 
     66{{{ 
     67    def render_macro(self, req, name, content): 
     68+        c = content.split("|") 
     69+        content = c[0] 
     70+        if len(c) > 1 : 
     71+                for i in c[1:] : 
     72+                        v = i.split("=") 
     73+                        if len(v) > 1 : 
     74+                                k = v[0] 
     75+                                v = v[1] 
     76+                                content = content.replace(k,v) 
     77}}} 
     78 
     79i.e. you can do something like this 
     80{{{ 
     81    {{{ 
     82    #!SQLTable 
     83        SELECT "a", count($id) as 'Number of Tickets'  
     84        FROM ticket 
     85        UNION 
     86        SELECT "b", count($id) as 'Number of Tickets'  
     87        FROM ticket|$id=id 
     88    }}} 
     89}}} 
     90Useful when you have the same id that you don't want to keep on retyping over. 
     91-----