23 Commits

Author SHA1 Message Date
Guillaume Gomez
3b52c907c3 Rename rinja into askama 2025-03-11 19:31:06 +01:00
chrisp60
0018b3bf77 fix: normalize macro args on call #259 2024-11-21 08:58:11 -05:00
Guillaume Gomez
6e13c81a5f Move types into their tests 2024-11-09 22:22:42 +01:00
Guillaume Gomez
6df0892d1a Make it possible to use macro arguments as default value 2024-10-25 23:24:11 +02:00
Guillaume Gomez
cf0d821b9e Add code generation for default value arguments 2024-10-25 23:21:05 +02:00
Guillaume Gomez
2d80cc3524 Rename everything to rinja 2024-06-17 15:58:52 +02:00
Guillaume Gomez
e4b8ca3c44 Allow trailing comma in macro definition and call 2023-12-07 11:03:26 +01:00
Guillaume Gomez
b5797cba88 Add macro test with only argument being passed as named 2023-12-07 09:10:32 +01:00
Guillaume Gomez
28e26751ce Add tests for named arguments in macro calls 2023-11-28 11:36:09 +01:00
max
5ee2dfbe6b Add test for macro self argument
Signed-off-by: max <gmx.sht@gmail.com>
2023-10-12 13:57:48 +02:00
mataha
cba1fb8e50 Allow macros to be defined and called without arguments
This commit introduces a shorthand for defining and calling macros when
using them as a reusable substitute for variables assigned complex values
(e.g. string literals with or without newline escapes). The use-case is
formatting - from my experience it's easier to visually parse a `macro`
`endmacro` block than a multiline variable assignment.

Signed-off-by: mataha <mataha@users.noreply.github.com>
2023-06-12 10:35:40 +02:00
Bastien Orivel
ea66be1925 Allow {% endmacro name %}
Just migrated a repo from tera to askama and this was one of the only
things that was different. This is also coherent with `{% block %}` for
which I added the same feature years ago.
2022-04-29 13:35:20 +02:00
René Kijewski
6d1cf5e43d Issue #379 was fixed
This PR adds the tests by @msrd0 <git@msrd0.de> that failed before.
The error was fixed somewhen between f23162a and now, so these tests
serve to prevent regressions in the future.

I simplified the tests very slightly to omit whitespaces in the output.
2021-07-30 21:57:00 +02:00
Ryan Kelly
49252d2457 Fix code generation for macro calls that store args in variables. 2021-06-22 11:41:45 +02:00
Christian Vallentin
f4065b09b9
Fixed implicit borrow of expressions (#390) 2020-12-01 09:25:36 +01:00
Dirkjan Ochtman
5549f9a3cd Use 2018 edition idioms 2018-12-08 21:43:20 +01:00
Dirkjan Ochtman
cf8dc532f0 Remove unused macro_use attributes 2018-12-08 21:43:20 +01:00
bott
4f2176a3ad Fix deep nested imports in macro calls 2018-09-07 20:09:52 +02:00
bott
f29c12f469 Add test for nested macro calls into different scope 2018-09-02 16:01:20 +02:00
larros
614ed6d16f Fix whitespace handling for macros and imports (#55)
Resolves https://github.com/djc/askama/issues/52.

* Fix of review comments
2017-10-01 18:00:05 +02:00
larros
df58dcb49d Add support for importing template files with macros (#51)
* Fix review comments for macro imports
2017-09-26 10:02:44 +02:00
Dirkjan Ochtman
57a10a789e Forgot to remove debugging cruft, again 2017-08-23 12:43:53 +02:00
Dirkjan Ochtman
d0a3d51dcd Add test for basic macro use 2017-08-22 20:22:33 +02:00