Include all whitespace?

22 views
Skip to first unread message

Ben Thompson

unread,
Jun 25, 2016, 5:07:08 PM6/25/16
to Mako Templates for Python
Hi there,

Is there a way to include blank lines for each line in a python block? For example,
<%
import amodule
a
= 1
b
= 2
func
(a,b)
%>
sometext
sometext

would be rendered to:






sometext
sometext

I am using mako for some code generation purposes where it's nice to have the lines in the original file match the lines in the rendered template -- then error messages from a compiler match with original file line numbers. 

Regards,
Ben

Jonathan Vanasco

unread,
Jun 29, 2016, 7:53:36 PM6/29/16
to Mako Templates for Python
I don't believe there is, but at the end of each file that mako generates is a source mapping as a docstring.  Make uses that on tracebacks to generate the correct error for the template.  you might be able to adapt that.

read:

write:
Reply all
Reply to author
Forward
0 new messages