| Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Closes #786
|
|
The previous implementation hid the error returned by render,
which made it impossible for callers to react to rendering errors.
While having a simple way to call into would be nice, there is not
way to have both implementations without adding any manual
specialization. Thus, the From impl is replaced by the TryFrom impl.
|
|
|
|
|
|
|
|
with-hyper now derives an impl allowing Templates to be passed
to functions with trait bounds for Into<hyper::Body>.
|
|
`parser.rs` was a single file containing almost 2000 lines.
This PR split the file into multiple, smaller files. `Expr`, `Node`, and
`Target` each get an own file. Each struct gets a `parse()` method that
return `Result<Self>`, and every other detail is private to the file.
This PR should make this essential part of Askama more easy to
understand, and make future modifications easier.
|
|
|
|
Since version 0.6, `toml` is a wrapper around `toml_edit`, and the more
basic library already meets our needs.
|
|
The configuration is made `'static`, because `toml` and `toml_edit` both
needs to implement serde's `DeserializeOwned` by now. We allocate the
strings once per template, so it is very unlikely that this change will
have any measurable impact, neither in compile time nor RAM usage.
|
|
|
|
This PR makes e.g. `{% leta = b %}` a parsing error. To the reader it
would appear that `leta` should be a meaningful expression in Askama,
which it is not. Before this PR, `leta` was tokenized as `let` + `a`.
This PR makes the parser try to find the longest identifier at a parsing
positions and only compare the outcome against the expected keyword.
This is potentially a breaking change, because code that should always
have been invalid will now fail to compile, when it was accepted before.
|
|
|
|
|
|
That part was missing from #632, because #632 came before #706, and I
forgot to update the older PR.
|
|
|
|
|
|
|
|
|
|
The support for the magic `_parent` field is deprecated since v0.8.0
or issue #180. It's bothersome to keep this feature alive, when no-one
should be using it for 3 years.
|
|
The integration is based on askama_gotham.
There is no specific trait to convert an arbitrary T to
`hyper::Response`, so I used `From<Template> for hyper::Response`.
|
|
|
|
Though Rocket 0.5 still only a release candidate, Rocket 0.4 severely
outdated, and depends on a bunch of crates with active security
advisories. Rocket 0.5 updates its dependencies to fixes versions.
Also Rocket 0.4 needs a nightly Rust, which caused multiple problems.
|
|
No need to work on references to references.
|
|
|
|
The generator cannot be accessed outside of crate, so it's not possible
to override the default hasher.
|
|
|
|
|
|
|
|
* Moved Features into derive, Updated Askama versions to 0.11
* Lock minimal versions to 0.11.2
|
|
|
|
All the hard work in askama_derive was actually done in askama_shared.
This PR removes the back-and-forth interaction between the two crates.
Now askama_derive is a single re-export of `#[derive(Template)]` which
has to be done in a proc_macro crate.
This most likely means that askama_derive is "final", unless another
derive template needs to be introduced in the future.
|
|
Before this PR the handling of integrations was done both by
askama_shared and askama_derive. This diff lets askama_shared do the
work. This will prevent problems like #629, when both packages might
come out of sync.
|
|
|
|
|
|
|
|
|
|
PathBuf is to String like Path is to str, so `&PathBuf` is a pointer to
a pointer. Clippy does not likes that.
|
|
|