How to break YATL helper onto multiple lines

41 views
Skip to first unread message

Richard Gordon

unread,
Aug 20, 2022, 2:01:54 PM8/20/22
to py4web
Instead of this:
<table>
[[
for id in logs:
    log=logs[id]
    =TR(TD(id),TD(log['foobar']))
    pass
]]
</table>

I want to break the TR onto multiple lines for readability, like this:
    =TR(
        TD(id),
        TD(log['foobar'])
        )

This generates a syntax error. Putting a \ at the end of each line doesn't help.

Any suggestions for how to do this correctly? (I looked but I couldn't find it in the doc.)

Massimo

unread,
Aug 20, 2022, 4:06:00 PM8/20/22
to py4web
You are correct. It does not work. I believe yatl supports this (the older template parser) but renoire does not (the new and faster one). That is unfortunate.

You can define a function to do this and call the function.

Massimo

Richard Gordon

unread,
Aug 20, 2022, 11:18:07 PM8/20/22
to py4web
Hmm. Bummer. Makes code hard to read.
Reply all
Reply to author
Forward
0 new messages