Closed serensoner closed 1 year ago
I'm looking for something similar but to add e.g. <a href="https://blahblah.blah/?q=CELL%20CONTENT">CELL CONTENT</a>
in a cell the would normally show CELL CONTENT
. Would it fix our cases and other cases if we could pass a list of tuples with columns names and a macro to be called for each cell in that column for a table?
An example would be:
render_table(...., macros=[('Category', 'my_macro')])
with implementation (in pseudo code)
if title[1] in macros:
# <td>{{ macros[title[1]](row[title[0]]) }}</td>
# which results in
<td>{{ my_macro(row[title[0]]) }}</td>
else:
<td>{{ row[title[0]] }}</td>
@serensnoer, for you what would be using self()
instead of my_macro()
.
@serensoner see https://github.com/greyli/bootstrap-flask/pull/204 which offers safe for specific columns.
Implemented in #204.
hey there, i'm using render table with a field that sometimes has multilines (separated by
\n
, or possibly<br />
. is there a way to show this as multilines using render_table? i triedrender_table(...)|safe
andrender_table(data, ..)|safe
but neither worked. any ideas?