Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10724 closed enhancement (duplicate)

[PATCH] render inner macros inside the SQLTable macro

Reported by: falkb Owned by: Ryan J Ollos
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 11 years ago by falkb

probably solves #4452

comment:2 Changed 11 years 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 11 years ago by Ryan J Ollos

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

comment:4 Changed 11 years ago by Ryan J Ollos

Resolution: duplicate
Status: newclosed

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

comment:5 Changed 11 years ago by anonymous

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

comment:6 Changed 11 years ago by Ryan J Ollos

#10814 is a regression ticket against [12459].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.