1606 Commits

Author SHA1 Message Date
René Kijewski
fafd44e4fe Add comments 2024-07-07 20:47:02 +02:00
René Kijewski
cf94c09e32 Add French translation 2024-07-07 19:00:00 +02:00
René Kijewski
efcffeea78 Add example app 2024-07-07 02:24:03 +02:00
Guillaume Gomez
e3c1fe3548
Merge pull request #46 from Kijewski/pr-one-less-allow
Remove a `#[allow(clippy::match_wild_err_arm)]`  and  dedup error message creation
2024-07-04 11:08:45 +02:00
René Kijewski
6a6994670d Show error reason when template could not be read 2024-07-04 11:02:58 +02:00
René Kijewski
55e8ff1d46 Dedup error message creation 2024-07-04 11:00:08 +02:00
René Kijewski
7bc362fcdc Remove a #[allow(clippy::match_wild_err_arm)] 2024-07-04 11:00:08 +02:00
Guillaume Gomez
83ef00c191
Merge pull request #45 from Kijewski/pr-rustfmt
Add `.rustfmt.toml` configuration
2024-07-04 10:51:47 +02:00
René Kijewski
ee3a9e675a Add .rustfmt.toml configuration
This PR configures the formatting with a few defaults that aid
readability, in my opinion. One drawback of adding this file is that
rustfmt uses unstable features, now, and you have to use nightly to run
it:

```sh
cargo +nightly fmt --all
```
2024-07-04 07:05:57 +02:00
Guillaume Gomez
37c300d483
Merge pull request #42 from GuillaumeGomez/top-level-nodes-errors
Generate better errors for top level nodes
2024-07-03 10:39:33 +02:00
René Kijewski
d4b363b9a4 Dedup top-level check in heritage 2024-07-03 01:18:36 +02:00
René Kijewski
20dc1a0139 Fix lifetime of WithSpan::span() 2024-07-03 00:48:09 +02:00
René Kijewski
bf20db307e FileInfo<'a, 'b, 'c>FileInfo<'a> 2024-07-03 00:26:03 +02:00
René Kijewski
b5f21c047c
Merge pull request #43 from GuillaumeGomez/move-in-let-statement
Prevent jinja `let` to move variables
2024-07-03 00:09:06 +02:00
Guillaume Gomez
70ca3f4e5d
Merge pull request #44 from softdevca/pr_strip_common
`strip_common` test was failing
2024-07-02 22:50:32 +02:00
Guillaume Gomez
e7f2979b73 Add regression test for moving variables in let statement 2024-07-02 22:40:09 +02:00
Sheldon Young
9e1e20cdb4 strip_common test was failing 2024-07-02 13:39:49 -07:00
Guillaume Gomez
fa467172dd Prevent jinja let to move variables 2024-07-02 22:39:28 +02:00
Guillaume Gomez
27e12f083b Add UI tests for top level nodes 2024-07-02 22:15:02 +02:00
Guillaume Gomez
79e7331ccc Generate better errors for top level nodes 2024-07-02 21:35:41 +02:00
René Kijewski
145127e241
Merge pull request #40 from GuillaumeGomez/rename-as_ref
Rename `as_ref` filter into `ref`
2024-07-02 15:49:17 +02:00
René Kijewski
ca85ef6050
Merge pull request #37 from GuillaumeGomez/method-call
Favor methods over closure fields
2024-07-02 15:45:41 +02:00
Guillaume Gomez
d0bcba7d1c Update book for methods calls 2024-07-02 13:44:27 +02:00
Guillaume Gomez
6c46e4f7b8 Update tests about methods use 2024-07-02 13:44:27 +02:00
Guillaume Gomez
f2dcd1737e Favor methods over closure fields 2024-07-02 12:14:20 +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
René Kijewski
223470eb20
Merge pull request #38 from GuillaumeGomez/prevent-macro-move-var
Prevent jinja macros to move variables
2024-07-02 02:01:39 +02:00
Guillaume Gomez
daac80ff60 Update book to mention * and & operators 2024-07-01 21:11:41 +02:00
Guillaume Gomez
e5a3e1c763 Add regression test for * and & in expressions 2024-07-01 21:11:41 +02:00
Guillaume Gomez
b37e7d3703 Rename as_ref filter into ref 2024-07-01 21:09:18 +02:00
Guillaume Gomez
e9fc4a6db3 Allow to use * and & in expressions 2024-07-01 20:54:13 +02:00
Guillaume Gomez
62bbece0aa Add regression test to prevent moving variables 2024-07-01 18:05:16 +02:00
Guillaume Gomez
6be20d5782 Prevent jinja macros to move variables 2024-07-01 18:05:12 +02:00
Guillaume Gomez
eb419049bf
Merge pull request #36 from Kijewski/rest-pattern-struct#2
Add support for `..` in let pattern matching for structs (alternative take)
2024-06-29 00:02:08 +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
0d8373e3b2 Linted 2024-06-28 23:06:21 +02:00
René Kijewski
cf4f514d7e Move passing tests 2024-06-28 23:03:22 +02:00
René Kijewski
e84e1a6af2 Move Target into its own file 2024-06-28 22:56:34 +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
e94525f483 Add support for .. in let pattern matching for structs 2024-06-28 05:25:21 +02:00
René Kijewski
214c4450b4
Merge pull request #32 from Kijewski/pr-uglier-json
Make JSON prettifying optional
2024-06-27 14:29:39 +02:00
René Kijewski
dcabf0cf1a feature: serde-json → serde_json 2024-06-27 14:25:22 +02:00
René Kijewski
64a8094aaf Split pretty and ugly JSON filter impl 2024-06-27 14:25:22 +02:00
René Kijewski
fd70667998
Merge pull request #34 from GuillaumeGomez/fix-links
Fix links in the book
2024-06-27 14:20:32 +02:00
Guillaume Gomez
5787781b78 Fix links in the book 2024-06-25 17:15:35 +02:00
René Kijewski
f7710a94d6 Add "json: too many args" ui test 2024-06-25 00:42:28 +02:00
René Kijewski
462c04c0a0 Make JSON prettifying optional
This PR adds an optional argument to the `|tojson` filter, which
controls if the serialized JSON data gets prettified or not. The
arguments works the same as flask's [`|tojson`][flask] filter, which
passes the argument to python's [`json.dumps()`][python]:

* Omitting the argument, providing a negative integer, or `None`, then
  compact JSON data is generated.
* Providing a non-negative integer, then this amount of ASCII spaces is
  used to indent the data. (Capped to 16 characters.)
* Providing a string, then this string is used as prefix. I attempts are
  made to ensure that the prefix actually consists of whitespaces,
  because chances are, that if you provide e.g. `&nsbp;`, then you are
  doing it intentionally.

This is a breaking change, because it changes the default behavior to
not prettify the data. This is done intentionally, because this is how
it works in flask.

[flask]: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.tojson
[python]: https://docs.python.org/3/library/json.html#json.dump
2024-06-25 00:12:25 +02:00
René Kijewski
78878f08b6
Merge pull request #31 from GuillaumeGomez/improve-level-api
Improve Level API a bit
2024-06-25 00:05:42 +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