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
René Kijewski
84b76ac966
Add HtmlSafe
reference wrapper tests
2024-11-03 00:37:06 +01:00
Guillaume Gomez
c87be3ec36
Relax rules for filesizeformat
filter
...
Remove `humansize` dependency
2024-11-01 00:51:03 +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
1e319fd0c8
Merge pull request #200 from Kijewski/pr-ref
...
Unify trait impl for reference wrapper types
2024-10-23 21:03:35 +08:00
Guillaume Gomez
c77cd37821
Add regression test for config delimiters
2024-10-20 05:06:06 +02:00
René Kijewski
f7d1e9a5b4
Unify trait impl for reference wrapper types
...
This changes makes sure that no implementation is forgotten and
deduplicates some code.
2024-10-16 21:46:59 +02:00
René Kijewski
f195158140
filters: remove num-traits
...
They were added in <https://github.com/djc/askama/pull/146 >.
The example when they might be useful sounds contrived. You can always
manually add the package `num-traits` to your project and use the
methods directly. `into_isize` and `into_f64` wasn't even documented in
the book.
2024-10-08 13:16:32 +02:00
René Kijewski
dfcfde9ce9
generator: use re-exported core
and std
...
This way, even a shadowed `core` or `std` does not prevent the generated
code from working correctly.
2024-10-04 06:40:00 +02:00
Guillaume Gomez
191fc15b6a
Fix typo
2024-10-03 14:48:50 +02:00
Guillaume Gomez
8ba1e16f3e
Add regression test for *
/&
operators in functions/methods arguments
2024-10-03 14:48:50 +02:00
René Kijewski
77931a774f
Merge pull request #179 from GuillaumeGomez/rust-macro-not-prepended
...
Do not prepend rust macro calls with `&`
2024-09-18 18:21:05 +02:00
Guillaume Gomez
40d10cea5e
Add regression test for rust macro calls not prepended with &
2024-09-18 17:37:26 +02:00
René Kijewski
eed37cd415
Run clippy --fix -- -D clippy::pedantic
2024-09-16 22:58:50 +02:00
René Kijewski
27443641f5
filters: escape arguments to pluralize
at compile time
2024-09-13 14:01:30 +02:00
René Kijewski
ecd0e6e84e
parser: make {#-#}
a syntax error
2024-09-11 03:27:53 +02:00
René Kijewski
1948d63241
parser: add context information for unknown tags
2024-09-10 16:09:42 +02:00
René Kijewski
7b4f1dc907
parser: add optional {% endwhen %}
2024-09-10 04:09:40 +02:00
Guillaume Gomez
a60c2e7db9
Add regression test for unclosed items
2024-09-10 02:40:12 +02:00
René Kijewski
3d6fa3e7ae
Merge pull request #151 from GuillaumeGomez/fix-loop-locals-context
...
Fix invalid locals context drop
2024-08-22 21:13:26 +02:00
Guillaume Gomez
c6c80fe6b7
Fix invalid locals context drop
2024-08-21 21:56:57 +02:00
René Kijewski
6cd78ac9ef
Apply review comments
2024-08-20 14:04:27 +02:00
René Kijewski
a7f6a3f32f
derive: allow in_doc = false
2024-08-20 12:09:54 +02:00
René Kijewski
42d58106b3
derive: add in_doc
attribute
2024-08-20 11:50:30 +02:00
René Kijewski
307daa3179
derive: feature gate "code-in-doc"
2024-08-20 11:50:30 +02:00
René Kijewski
6a612e510b
derive: use pulldown-cmark to interpret comments
2024-08-20 11:50:30 +02:00
René Kijewski
96fae8b8db
derive: allow supplying source in comment
...
Using `#[template(source = "…")]` is tiresome, because you have to
escape the input. That makes it difficult to read, too. Using
`#[template(path = "…")` can be tiresome, too, if the code is small
and/or if you just want to prototype something.
This PR adds a third option to supply the source of a template: You can
supply the source in the comments of a template. This works similar to
doctest. Any <code>```rinja```</code> block gets extracted, and the
combined blocks are the source code of the template.
2024-08-20 11:50:30 +02:00
Guillaume Gomez
b8404c7828
Add ui regression test for new escape
filter error
2024-08-18 22:43:59 +02:00
Guillaume Gomez
71f49a8fc2
Add support for prefixes for string literals
2024-08-18 22:43:59 +02:00
Guillaume Gomez
1a24ace17b
Add support for b
prefix for char literals
2024-08-18 22:35:03 +02:00
Guillaume Gomez
7a7e415822
Add support for |
operator in when
2024-08-15 21:10:29 +02:00
René Kijewski
90096ef973
ci: sort elements in Cargo.toml
2024-08-13 19:17:37 +02:00
Guillaume Gomez
d5fef24ff7
Merge pull request #119 from Kijewski/pr-no-when
...
parser: allow `match` nodes w/o `when` if there is an `else`
2024-08-13 17:48:15 +02:00
René Kijewski
ed91a909ab
derive: better error messages for syntax testing
2024-08-13 17:39:57 +02:00
René Kijewski
e4c5ca3f6b
parser: reject closing delims that look like an op
2024-08-13 16:56:33 +02:00
Guillaume Gomez
9873ea065f
Improve compile-time if conditions handling
2024-08-09 20:32:38 +02:00