Guillaume Gomez
3b52c907c3
Rename rinja
into askama
2025-03-11 19:31:06 +01:00
René Kijewski
13eea3bd74
derive: fail if requested template block is missing
...
Previously it was only tested if the block exists if there were any
blocks. If there weren't any, then an empty result would be rendered.
2025-02-08 23:00:54 +01:00
René Kijewski
137aaa0604
derive: implement template attribute blocks
2025-02-08 02:07:01 +01:00
René Kijewski
f0ded0ba32
derive: add span to missing block message
2025-02-07 23:29:04 +01:00
René Kijewski
f759c364f9
derive: no rinja
on enum variants
2025-02-07 23:20:12 +01:00
René Kijewski
c13059096e
Fix error messages
2025-02-04 22:45:40 +01:00
Guillaume Gomez
f361293da7
Improve macro call arguments mismatch errors
2025-02-04 22:45:40 +01:00
René Kijewski
30e664182d
derive: for enum
s, let Self
refer to the original type
2025-02-04 01:24:59 +01:00
René Kijewski
1066c884f3
book: add enum documentation
2025-01-26 02:23:51 +01:00
René Kijewski
5944ab9bef
Implement enum
variants
2025-01-26 02:23:51 +01:00
René Kijewski
94288391b3
derive: add ".askama" to list of HTML extensions
2025-01-25 20:00:30 +01:00
Guillaume Gomez
b72622120d
Add support for "runtime" values
2025-01-23 23:43:43 +01:00
Guillaume Gomez
7947cdcafb
Fix ui test
2025-01-12 19:43:39 +01:00
Guillaume Gomez
8d6279d9c8
Merge pull request #279 from GuillaumeGomez/block_in_include
...
Fix `block_in_include` and add explanations on what is going on
2025-01-01 12:15:33 +01:00
René Kijewski
9336435859
derive: keep track of called macros
...
Recursive macro calls, direct and indirect, would cause a stackoverflow.
This PR lets the macro call handler keep track of the stack of called
macros we are currently in, so we can abort with an error message
instead of panicking.
2024-12-29 07:52:21 +01:00
René Kijewski
4b8bd45844
parser: use drop guards to track nesting level
...
Not for all operations the nesting level was incremented when needed
and/or the un-incremented nesting level was used in subfunction calls.
Binary operators such as `*` did not properly increment the nesting
level.
This PR changes `Level` in such a way that it can be used to keep track
of the nesting level when used in a loop. It is now impossible to
accidentally refer to an old nesting level value.
Resolves <https://issues.oss-fuzz.com/issues/385256115 >.
2024-12-27 04:31:24 +01:00
Guillaume Gomez
8a20caa136
Fix block_in_include
and add explanations on what is going on
2024-12-22 21:11:04 +01:00
René Kijewski
18f1d9b343
parser: deny rust 2024 keyword gen
as target name
2024-12-21 23:50:13 +01:00
René Kijewski
c80e78e8b5
parser: deny all rust keywords as target names
2024-12-21 23:49:48 +01:00
Guillaume Gomez
0d91bee794
Update ui tests
2024-12-21 23:06:56 +01:00
René Kijewski
e800b7ca90
derive: reserve variable prefix __rinja
and free name writer
2024-12-21 19:42:03 +01:00
René Kijewski
fe36573926
Let operator ?
only wrap the error in Box if needed
...
This leads to fewer needless allocations, and makes the operator `?`
usable in an no-alloc context.
2024-12-21 18:53:44 +01:00
René Kijewski
74bf996ff3
derive: update expected output for newer trybuild versions
2024-12-16 11:46:16 +01:00
Luca Palmieri
f0ac41df30
Reproduce bug with a test
2024-12-15 12:07:11 +01:00
René Kijewski
42b4a1c272
derive: fix typo to not print whole rem file on error
2024-12-13 02:54:43 +01:00
René Kijewski
430b99bdac
Fix clippy warnings in rust nightly 1.85
2024-12-11 19:50:29 +01:00
René Kijewski
e08c28c126
Only run UI tests on stable rust
2024-12-11 19:50:29 +01:00
René Kijewski
66dac1df06
Add failing test from issue 272
...
Reported by Ciprian Dorin Craciun ([@cipriancraciun]) in issue [#272 ].
[#272 ]: <https://github.com/rinja-rs/rinja/issues/272 >
[@cipriancraciun]: <https://github.com/cipriancraciun >
2024-11-26 07:23:37 +01:00
René Kijewski
50f50e3931
derive: a safe-guard to disable bindings a unit struct was expected
...
This does not fix the error, as rinja is not able to tell was the
actually intended to do, but rust gives you a guide what the error is,
and the error is not silently ignored.
2024-11-24 19:06:47 +01:00
René Kijewski
e2515bdacb
derive: reword in_doc
error message if code block is absent
2024-11-24 01:08:51 +01:00
René Kijewski
277cdb4f87
derive: PartialTemplateArgs
actually does not need keep track of the argument keys
2024-11-24 01:08:51 +01:00
Guillaume Gomez
07e6216e83
Allow variables to be inherited in blocks
2024-11-22 18:44:42 +01:00
chrisp60
0018b3bf77
fix: normalize macro args on call #259
2024-11-21 08:58:11 -05:00
Guillaume Gomez
8dbbb9ae48
Allow to create variables named _
2024-11-20 14:55:05 +01:00
Guillaume Gomez
7aa8868b29
Extend checks for underscore ident misuses
2024-11-19 21:21:54 +01:00
Guillaume Gomez
f39a846598
Allow idents to start with _
2024-11-19 18:10:06 +01:00
René Kijewski
968b80fcb8
Remove EXTENSION
constant from Template
...
I doubt that is needed in any circumstance, and it makes implementing
enum variants harder.
2024-11-18 16:55:30 +01:00
René Kijewski
26f6808aa6
derive: fix typos and unify error messages
2024-11-18 15:43:16 +01:00
Guillaume Gomez
f3cff091b7
Merge pull request #250 from GuillaumeGomez/filters
...
Remove restriction preventing to have | surrounded by whistespace characters
2024-11-18 15:28:26 +01:00
Guillaume Gomez
d7bc44a87d
Remove restriction preventing to have |
surrounded by whistespace characters
2024-11-17 20:25:01 +01:00
Guillaume Gomez
b0d834c0fd
Improve error message when an extension escaper is missing
2024-11-15 15:02:10 +01:00
René Kijewski
ebdd3f8b43
parser: allow whitespace control on extends
2024-11-14 16:53:14 +01:00
René Kijewski
c5ed6af5a3
parser: add better error messages for broken closing block tags
2024-11-13 20:14:42 +01:00
René Kijewski
e7f5de2697
Add garbled closing block test
2024-11-13 20:03:08 +01:00
René Kijewski
7f9c91de0b
Add concat operator ~
...
The string concatenation operator `~` is present in jinja and tera:
<https://jinja.palletsprojects.com/en/stable/templates/#other-operators >.
While it's not the most important operator, it can come in handy e.g.
with filters: `{{ a|upper }}{{ b|upper }}` → `{{ (a ~ b)|upper }}`.
2024-11-12 17:07:17 +01:00
René Kijewski
3e07719ad9
derive: reject unions
as they require unsafe
code
2024-11-11 00:55:47 +01:00
René Kijewski
fe551596f3
union
s generate invalid code
2024-11-11 00:42:08 +01:00
Guillaume Gomez
6e13c81a5f
Move types into their tests
2024-11-09 22:22:42 +01:00
Guillaume Gomez
e98cfa9ce8
Merge pull request #207 from GuillaumeGomez/macro-default-value
...
Add support for default value in macros
2024-11-09 19:18:49 +08:00
René Kijewski
19db2765b7
parser: more strict macro argument parsing
2024-11-09 08:37:54 +01:00