ThiefMaster
ThiefMaster

Reputation: 318498

Is there a way to use Mako templates for plain-text files where newlines matter?

In an existing application we are using Mako templates (unfortunately..). That works ok for HTML output since newlines do not matter.

However, we now need to generate a text/plain email using a template - so any newlines introduced by control statements are not acceptable.

Does Mako provide any options to make statement lines (i.e. those starting with %) not cause a newline in the output? I checked the docs but couldn't find anything so far...

Upvotes: 2

Views: 1115

Answers (1)

atrac
atrac

Reputation: 51

If you add a backslash at the end of the line like this: "<% %>\", you can suppress the newline.

Upvotes: 5

Related Questions