Ticket #10724 (closed enhancement: duplicate)

Opened 5 months ago

Last modified 3 months ago

[PATCH] render inner macros inside the SQLTable macro

Reported by: falkb Assigned to: 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:

Index: wikitablemacro/trunk/wikitable/table.py
===================================================================
--- wikitablemacro/trunk/wikitable/table.py	(revision 12458)
+++ wikitablemacro/trunk/wikitable/table.py	(working copy)
@@ -14,6 +14,7 @@
 from trac.core import implements
 from trac.web.chrome import ITemplateProvider, add_stylesheet
 from trac.wiki.formatter import system_message
+from trac.wiki import wiki_to_html
 from trac.wiki.macros import WikiMacroBase
 from trac.util.html import Markup
 from trac.util.text import exception_to_unicode
@@ -64,7 +65,8 @@
             css_class = (idx % 2 == 0) and 'odd' or 'even'
             print >> out, "  <tr class='%s'>" % css_class
             for col in row:
-                print >> out, "<td>%s</td>" % col
+                text = wiki_to_html(StringIO(col).getvalue(), self.env, req)
+                print >> out, "<td>%s</td>" % text
             print >> out, "  </tr>"
 
         print >> out, " </tbody>"

Attachments

Change History

12/21/12 15:25:58 changed by falkb

probably solves #4452

12/21/12 16:51:19 changed by anonymous

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

12/21/12 17:08:10 changed by rjollos

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

12/21/12 17:12:16 changed by rjollos

  • status changed from new to closed.
  • resolution set to duplicate.

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

12/21/12 21:06:13 changed by anonymous

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

02/21/13 22:18:56 changed by rjollos

#10814 is a regression ticket against [12459].


Add/Change #10724 ([PATCH] render inner macros inside the SQLTable macro)




Change Properties
Action