Modify

Opened 21 months ago

Closed 21 months ago

Last modified 19 months ago

#10724 closed enhancement (duplicate)

[PATCH] render inner macros inside the SQLTable macro

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

Description

Imagine this construct:

{{{
#!SQLTable
SELECT DISTINCT
  ( SELECT value FROM session_attribute WHERE name='pagemoderator' AND Sid=m.Sid ) AS "Standard",
  "[[Image(" || REPLACE(
                         REPLACE(
                                   ( SELECT value FROM session_attribute WHERE name='picture_href' AND Sid=m.Sid ), '/myproject/raw-attachment/wiki/', '' ), '/', ':')
                       || ", center, 50px)]][[BR]]" ||   ( SELECT value FROM session_attribute WHERE name='name' AND Sid=m.Sid ) AS "Moderator",
  ( SELECT value FROM session_attribute WHERE name='email'          AND Sid=m.Sid ) AS "Email"
FROM
  session_attribute m
WHERE
  name='pagemoderator' AND NOT value=''
ORDER BY
  Standard
}}}

The following patch let the table appear with all bells and whistles:

  • wikitablemacro/trunk/wikitable/table.py

     
    1414from trac.core import implements 
    1515from trac.web.chrome import ITemplateProvider, add_stylesheet 
    1616from trac.wiki.formatter import system_message 
     17from trac.wiki import wiki_to_html 
    1718from trac.wiki.macros import WikiMacroBase 
    1819from trac.util.html import Markup 
    1920from trac.util.text import exception_to_unicode 
     
    6465            css_class = (idx % 2 == 0) and 'odd' or 'even' 
    6566            print >> out, "  <tr class='%s'>" % css_class 
    6667            for col in row: 
    67                 print >> out, "<td>%s</td>" % col 
     68                text = wiki_to_html(StringIO(col).getvalue(), self.env, req) 
     69                print >> out, "<td>%s</td>" % text 
    6870            print >> out, "  </tr>" 
    6971 
    7072        print >> out, " </tbody>" 

Attachments (0)

Change History (6)

comment:1 Changed 21 months ago by falkb

probably solves #4452

comment:2 Changed 21 months ago by anonymous

Thanks, I'm testing it out now. Note that wiki_to_html is deprecated, and format_to_html should be used instead.

comment:3 Changed 21 months ago by rjollos

(In [12459]) Refs #4452, #10724: Parse table data as wiki markup and format to HTML.

comment:4 Changed 21 months ago by rjollos

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #4452, please follow-up in that ticket.

comment:5 Changed 21 months ago by anonymous

oh yeah, I reinvented the wheel, didn't read it there :)

comment:6 Changed 19 months ago by rjollos

#10814 is a regression ticket against [12459].

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.