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
Guillaume Gomez
a60c2e7db9
Add regression test for unclosed items
2024-09-10 02:40:12 +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
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
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
René Kijewski
f818c582bf
parser: allow match
nodes w/o when
if there is an else
2024-08-08 22:28:14 +02:00
René Kijewski
5efd31310f
parser: understand arbitrarily mixed up end nodes
2024-08-07 20:43:18 +02:00
René Kijewski
dec67c686b
parser: tell user proper keyword to end node
2024-08-07 20:30:25 +02:00
René Kijewski
0628afaf5e
parser: add wrong node terminator test
2024-08-07 20:28:33 +02:00
Guillaume Gomez
ebcfff66cc
Merge pull request #117 from Kijewski/pr-template-times-x
...
derive: allow split up template attributes
2024-08-07 14:38:33 +02:00
René Kijewski
f25dac9409
derive: allow split up template attributes
...
In generated code or macros, it might be useful to emit multiple
`#[template]` attributes. E.g.
```rust
#[template(source = "Hello!")]
#[template(ext = "txt")]
struct Hello;
```
2024-08-07 07:09:19 +02:00
René Kijewski
1ff32cb0ab
derive: understand extension .rinja
2024-08-07 06:12:42 +02:00
Guillaume Gomez
4de78ad9be
Improve compilation error message for invalid usage of rest pattern
2024-07-31 19:28:50 +02:00
Guillaume Gomez
c860a22e85
Add test for rest pattern
2024-07-30 22:31:42 +02:00
René Kijewski
5e98580ae3
derive: highlight value, not key
2024-07-30 14:04:19 +02:00
René Kijewski
08674bde11
derive: without rendered message for now
2024-07-29 21:57:28 +02:00
René Kijewski
821a147b37
Doens't work: no indentation
2024-07-29 18:38:32 +02:00
René Kijewski
2e887a56a6
derive: use config span in error message
2024-07-29 16:50:39 +02:00
René Kijewski
c3639ec14a
derive: use source/path as error source span
2024-07-29 15:48:18 +02:00
René Kijewski
fa8c936cff
derive: way less noisy error messages
2024-07-29 13:46:31 +02:00
René Kijewski
380ecc1d8e
derive: properly display error locations
2024-07-29 05:05:00 +02:00
Guillaume Gomez
e74f0d20ba
Change the error message to make it start at the as
keyword
2024-07-28 21:37:22 +02:00
René Kijewski
a6a474514e
Implement operator as
in template language
...
Because it is not always super obvious if an identifier refers to `T` or
`&T`, any references are automatically followed.
2024-07-28 18:02:14 +02:00
Guillaume Gomez
fcf1a97d9d
Add tests for if (not) defined
feature
2024-07-24 13:14:51 +02:00
René Kijewski
b593f1ffa7
parser: better error msg for unkn. number suffices
2024-07-20 12:15:13 +02:00
Guillaume Gomez
b753dd6e4d
Add more tests for filter block feature
2024-07-13 10:29:11 +02:00
René Kijewski
34073642b1
Run typos
to fix typos
2024-07-12 07:07:00 +02:00
René Kijewski
9beca5ed10
Add MsgValidEscapers
to show list of configured escapers
2024-07-07 22:51:57 +02:00
René Kijewski
6b0ea27742
More useful error message and UI tests for missing escaper
2024-07-07 22:51:23 +02:00
René Kijewski
6a6994670d
Show error reason when template could not be read
2024-07-04 11:02:58 +02:00
René Kijewski
d4b363b9a4
Dedup top-level check in heritage
2024-07-03 01:18:36 +02:00
Guillaume Gomez
27e12f083b
Add UI tests for top level nodes
2024-07-02 22:15:02 +02:00
René Kijewski
79e747a28a
Merge pull request #39 from GuillaumeGomez/ref-deref-ops
...
Allow to use `*` and `&` in expressions
2024-07-02 02:03:25 +02:00
Guillaume Gomez
e5a3e1c763
Add regression test for *
and &
in expressions
2024-07-01 21:11:41 +02:00
René Kijewski
f4ccdb6585
Better information that ..
must come last in a named struct
2024-06-28 23:32:13 +02:00
René Kijewski
cf4f514d7e
Move passing tests
2024-06-28 23:03:22 +02:00
René Kijewski
6b8b97672a
Better error message on missing comma
2024-06-28 22:48:45 +02:00
Guillaume Gomez
6ee3765098
Add regression test for ..
pattern in structs
2024-06-28 05:25:21 +02:00
René Kijewski
f7710a94d6
Add "json: too many args" ui test
2024-06-25 00:42:28 +02:00
Guillaume Gomez
fd1108c4bc
Merge pull request #18 from Kijewski/pr-iso646
...
Use ISO 646 alternative operators for bit ops + proper error messages for spaces around the `|filter` operator
2024-06-24 14:04:53 +02:00
Guillaume Gomez
1f1cff059d
Update ui tests
2024-06-23 20:55:23 +02:00
René Kijewski
50ac555684
Remove helper functions
2024-06-23 20:55:00 +02:00