aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add poem integrationHEADmainLibravatar cel 🌸2024-01-241-0/+16
|
* Allow included templates to `extend`, `import`, and `macro`Libravatar max2024-01-171-21/+29
| | | | Signed-off-by: max <gmx.sht@gmail.com>
* Generator: make `normalize_identifier` faster (#946)Libravatar René Kijewski2024-01-121-54/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `normalize_identifier` is called quite often in the generator, once for every variable name or path element that is written. This PR aims to speed up the function by * using a per-length input string length replacement map * binary searching the replacement map instead of a linear search Diffent, but functionally equivalent implementations were compared: ```text * linear search in one big map: 348.44 µs * binary search in one big map: 334.46 µs * linear search in a per-length map: 178.84 µs * binary search in a per-length map: 154.54 µs * perfect hashing: 170.87 µs ``` The winner of this competition is "binary search in a per-length map". It does not introduce new dependencies, but has the slight disadvantage that it uses one instance of `unsafe` code. I deem this disadvantage acceptable, though. Nb. It was also tested if a variant that only stores the replaced string would be faster. This "optimization" proved to be slower for all implementations except "binary search in a per-length map", for which it has the same runtime. Without a clear advantage to use the "optimized version", I chose to use the more easy to read slice of tuples variant. Obviously, for all measurements: YMMV.
* Add `as_ref` builtin filterLibravatar Guillaume Gomez2024-01-121-0/+17
|
* Revert "Add automatic borrowing to let statement"Libravatar Guillaume Gomez2024-01-101-7/+0
| | | | This reverts commit 3d52283b74573af509deb3c47cbabf7b7b58b1dd.
* Make the `markdown` filter compatible with `String`Libravatar Jakub Stachurski2024-01-091-1/+1
| | | | | | | | | | | | | | | | | This commit solves issue #719. This is done by making the markdown filter borrow the string and simplifying the filter to accept `&str` instead of `AsRef<str>` Add test for the markdown filter using as input Revert markdown filter changes Revert unnecessary changes Improve test_markdown_owned_string test Use cargo fmt
* Add automatic borrowing to let statementLibravatar max2023-12-131-0/+7
| | | | Signed-off-by: max <gmx.sht@gmail.com>
* Bugfix in `is_attr_self()`Libravatar max2023-12-131-1/+1
| | | | Signed-off-by: max <gmx.sht@gmail.com>
* Allow to pass named arguments to macro callsLibravatar Guillaume Gomez2023-11-281-1/+55
|
* Enhance match to include multiple targets (#911)Libravatar PizzasBear2023-11-221-0/+10
| | | Signed-off-by: max <gmx.sht@gmail.com>
* Improve macro call arguments loopLibravatar Guillaume Gomez2023-11-201-4/+1
|
* Improve output error for non-matching number of arguments for macrosLibravatar Guillaume Gomez2023-11-201-1/+8
|
* Remove unused `_did_loop` condition if `else` block is emptyLibravatar Guillaume Gomez2023-11-011-9/+21
|
* Avoid passing around duplicate dataLibravatar Dirkjan Ochtman2023-11-011-13/+2
|
* Cleanup imports a bitLibravatar Dirkjan Ochtman2023-11-011-4/+4
|
* Implement Default for MapChainLibravatar Dirkjan Ochtman2023-11-011-7/+9
|
* Move build_template() up to the crate rootLibravatar Dirkjan Ochtman2023-11-011-61/+8
|
* Remove unnecessary type annotationLibravatar Dirkjan Ochtman2023-11-011-1/+1
|
* Attach find_used_templates() to TemplateInputLibravatar Dirkjan Ochtman2023-11-011-42/+1
|
* Move TemplateArgs into input moduleLibravatar Dirkjan Ochtman2023-11-011-129/+2
|
* Inline nested derive_template() implementationLibravatar Dirkjan Ochtman2023-11-011-11/+1
|
* Allow macros to take `self` as an argumentLibravatar PizzasBear2023-10-121-1/+1
|
* parser: import `parser::{Expr, Node}`Libravatar René Kijewski2023-08-011-3/+2
|
* parser: add type for `Node::Comment`Libravatar René Kijewski2023-08-011-5/+5
|
* parser: remove re-exports `parser::{node,expr}::*`Libravatar René Kijewski2023-08-011-3/+5
|
* parser: add type for `Node::Extends`Libravatar René Kijewski2023-08-011-1/+1
|
* parser: add type for `Node::Include`Libravatar René Kijewski2023-08-011-8/+7
|
* parser: rename `Node::Cond` into `If` and add typeLibravatar René Kijewski2023-08-011-8/+7
|
* parser: add type for `Node::Let`Libravatar René Kijewski2023-08-011-31/+19
|
* parser: add type for `Node::Raw`Libravatar René Kijewski2023-08-011-4/+4
|
* parser: add type for `Node::Lit`Libravatar René Kijewski2023-08-011-6/+7
|
* parser: add type for `Node::BlockDef`Libravatar René Kijewski2023-08-011-14/+6
|
* parser: add type for `Node::Match`Libravatar René Kijewski2023-08-011-7/+11
|
* parser: add type for `Node::Call`Libravatar René Kijewski2023-08-011-7/+10
|
* parser: add type for `Node::Import`Libravatar René Kijewski2023-08-011-4/+4
|
* parser: let `Macro` know its nameLibravatar René Kijewski2023-08-011-1/+1
|
* parser: rename block to nodesLibravatar Dirkjan Ochtman2023-07-311-3/+3
|
* parser: define a struct for MatchLibravatar Dirkjan Ochtman2023-07-311-4/+3
|
* parser: define a struct for CondLibravatar Dirkjan Ochtman2023-07-311-4/+4
|
* Extract askama_parser crateLibravatar Dirkjan Ochtman2023-07-311-1/+1
|
* derive: move Parsed into parser moduleLibravatar Dirkjan Ochtman2023-07-311-36/+1
|
* derive: move generator-specific methods out of ExprLibravatar Dirkjan Ochtman2023-07-311-2/+71
|
* derive: define separate ParseError typeLibravatar Dirkjan Ochtman2023-07-311-1/+5
|
* derive: move Syntax into parser moduleLibravatar Dirkjan Ochtman2023-07-311-2/+1
|
* Fix Rust macro invocations not accepting a path (#837)Libravatar Matthew Taylor2023-07-241-3/+3
|
* Cache include AST to reduce parsing overheadLibravatar Dirkjan Ochtman2023-06-281-23/+16
|
* Inline child() method to avoid borrowing all fieldsLibravatar Dirkjan Ochtman2023-06-281-27/+23
|
* Avoid reparsing included templates if possibleLibravatar Dirkjan Ochtman2023-06-281-4/+23
|
* Parse templates onceLibravatar Dirkjan Ochtman2023-06-281-13/+44
|
* Update to rocket 0.5-rc.3Libravatar Vypo Mouse2023-05-191-6/+15
|