pallets / jinja

A very fast and expressive template engine.
https://jinja.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
10.36k stars 1.62k forks source link

Support triple quotes #1669

Closed sebringj closed 2 years ago

sebringj commented 2 years ago

Support triple quotes (double or single) for a very common use case with gettext or translation libraries like it

For example, you use pybabel gettext like so:

<p>
{{getext("I have some text here that should span more than 2 lines but I don't like inlining it like this because it sucks and would rather have it formatted nicely so I don't have to do this. Do you agree?")}}
</p>

But would be nice to do:

<p>
   {{getext("""
   I have some text here that should span more than 2 lines 
   but I don't like inlining it like this because it sucks and would 
   rather have it formatted nicely so I don't have to do this. 
   Do you agree?
   """)}}
</p>
ThiefMaster commented 2 years ago

Use {% trans %}..{% endtrans %} for this.