Modify

Opened 19 months ago

#10723 new enhancement

Allow variables to be passed to the wikiprocessor

Reported by: rjollos Owned by: rjollos
Priority: normal Component: WikiTableMacro
Severity: normal Keywords:
Cc: Trac Release:

Description

This was previously attached to the project wiki page:

I added below to render_macro to provide a rudimentary sort of variable function.

    def render_macro(self, req, name, content):
+        c = content.split("|;|")
+        content = c[0]
+        if len(c) > 1 :
+                for i in c[1:] :
+                        v = i.split("=")
+                        if len(v) > 1 :
+                                k = v[0]
+                                v = v[1]
+                                content = content.replace(k,v)

i.e. you can do something like this

{{{
#!SQLTable
    SELECT "a", count($id) as 'Number of Tickets' 
    FROM ticket
    UNION
    SELECT "b", count($id) as 'Number of Tickets' 
    FROM ticket|;|$id=id
}}}

Useful when you have the same id that you don't want to keep on retyping over.

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.