Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render_table and multiline #212

Closed
serensoner opened this issue Feb 13, 2022 · 4 comments
Closed

render_table and multiline #212

serensoner opened this issue Feb 13, 2022 · 4 comments
Labels

Comments

@serensoner
Copy link

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 tried render_table(...)|safe and render_table(data, ..)|safe but neither worked. any ideas?

@PanderMusubi
Copy link
Collaborator

PanderMusubi commented Feb 14, 2022

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>

@PanderMusubi
Copy link
Collaborator

@serensnoer, for you what would be using self() instead of my_macro().

@PanderMusubi
Copy link
Collaborator

@serensoner see #204 which offers safe for specific columns.

@greyli
Copy link
Member

greyli commented Aug 20, 2022

Implemented in #204.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants