aboutsummaryrefslogtreecommitdiffstats
path: root/testing/templates (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add test specifically for named blocks, and named macrosLibravatar Guillaume Gomez2023-10-231-0/+9
|
* Add test for macro self argumentLibravatar max2023-10-121-0/+5
| | | | Signed-off-by: max <gmx.sht@gmail.com>
* Fix Rust macro invocations not accepting a path (#837)Libravatar Matthew Taylor2023-07-241-0/+1
|
* Allow macros to be defined and called without argumentsLibravatar mataha2023-06-121-0/+21
| | | | | | | | | | 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>
* Propogate size_hint from sub-blocks (#788)Libravatar Andrew Dona-Couch -- GitHub drop ICE2023-03-063-0/+5
| | | Closes #786
* Allow `{% endmacro name %}`Libravatar Bastien Orivel2022-04-291-0/+12
| | | | | | Just migrated a repo from tera to askama and this was one of the only things that was different. This is also coherent with `{% block %}` for which I added the same feature years ago.
* Make json filter safeLibravatar René Kijewski2022-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | Previously the built-in json filter had an issue that made it unsafe to use in HTML data. When used in HTML attributes an attacker who is able to supply an arbitrary string that should be JSON encoded could close the containing HTML element e.g. with `"</div>"`, and write arbitrary HTML code afterwards as long as they use apostrophes instead of quotation marks. The programmer could make this use case safe by explicitly escaping the JSON result: `{{data|json|escape}}`. In a `<script>` context the json filter was not usable at all, because in scripts HTML escaped entities are not parsed outside of XHTML documents. Without using the safe filter an attacker could close the current script using `"</script>"`. This PR fixes the problem by always escaping less-than, greater-than, ampersand, and apostrophe characters using their JSON unicode escape sequence `\u00xx`. Unless the programmer explicitly uses the safe filter, quotation marks are HTML encoded as `&quot`. In scripts the programmer should use the safe filter, otherwise not.
* Allow whitespace trimming in {{raw}} blocksLibravatar René Kijewski2021-11-291-0/+2
|
* Add {% break %} and {% continue %}Libravatar René Kijewski2021-08-301-0/+11
| | | | | This PR adds `{% break %}` and `{% continue %}` statements to break out of a loop, or continue with the next element of the iterator.
* Add test case for matching on Option<bool>Libravatar Restioson2021-08-251-0/+8
|
* Issue #379 was fixedLibravatar René Kijewski2021-07-302-0/+28
| | | | | | | | This PR adds the tests by @msrd0 <git@msrd0.de> that failed before. The error was fixed somewhen between f23162a and now, so these tests serve to prevent regressions in the future. I simplified the tests very slightly to omit whitespaces in the output.
* Use "target()" to parse "when" blockLibravatar René Kijewski2021-07-301-0/+10
| | | | | | | | | | | | `target()` as used in parsing "let" and "if let" implements parsing nested tuples and structs. But it does not implement parsing literals. The functions `match_variant()` and `with_parameters()` as used in parsing "when" blocks do not implement parsing nested structs, but it implements parsing literals. This PR combines `match_variant()` and `with_parameters()` into `target()`, so that all `{%when%}` support nested structs, too.
* Add tuple destructoring testsLibravatar René Kijewski2021-07-051-0/+3
|
* Replace rust_macro test to work on nightlyLibravatar René Kijewski2021-07-021-3/+3
| | | | | | | | | | | | | | | | The current rust_test uses `stringify!()`. The documentation gives us the warning: > Note that the expanded results of the input tokens may change in the > future. You should be careful if you rely on the output. In the current nightly rust the result was indeed changed, so the test not fails. This PR replaces the test with another macro, that does not depend on `stringify!()`. Closes issue #504.
* Add "if let" testsLibravatar René Kijewski2021-07-014-0/+10
|
* Fix code generation for macro calls that store args in variables.Libravatar Ryan Kelly2021-06-221-0/+9
|
* Added path and ext testsLibravatar vallentin2021-03-103-0/+3
|
* Added let shadow testLibravatar vallentin2020-12-251-0/+22
|
* Improved if statement generation to avoid issues with implicit borrows (#392)Libravatar Christian Vallentin2020-12-011-0/+51
| | | | | | | * Changed to automatically coerce to bool * Added new test case * Updated test case to include else if
* Fixed implicit borrow of expressions (#390)Libravatar Christian Vallentin2020-12-011-0/+9
|
* Use efficient method for nested template renderingLibravatar Dirkjan Ochtman2020-08-251-3/+3
|
* Fix additional clippy issueLibravatar Dirkjan Ochtman2020-07-201-1/+1
|
* Clean up clippy issuesLibravatar Dirkjan Ochtman2020-07-201-2/+1
|
* Add tests for allow whitespaces patchLibravatar Ciprian Dorin Craciun2020-06-301-0/+63
|
* Move Iron integration into a separate askama_iron crateLibravatar Dirkjan Ochtman2020-01-291-1/+0
|
* Add new templatesLibravatar Dirkjan Ochtman2020-01-122-0/+6
|
* Support escaping in string literalsLibravatar Tuomas Siipola2020-01-121-0/+2
| | | | | | Do not attempt to parse escape sequences thoroughly. Instead let the Rust compiler to check the string literals and provide nice error messages if necessary.
* Support char literalsLibravatar Tuomas Siipola2020-01-032-0/+9
|
* Reformat test for better readabilityLibravatar Dirkjan Ochtman2019-10-091-15/+3
|
* Limit test sensitivity to macro pretty printing outputLibravatar Dirkjan Ochtman2019-10-091-14/+3
| | | | See https://github.com/rust-lang/rust/issues/65207.
* Add support for boolean literalsLibravatar Dave Poulter2019-10-081-0/+2
|
* WIP: Add raw blockLibravatar Pavel Fokin2019-04-182-0/+8
|
* Move small templates into source codeLibravatar Dirkjan Ochtman2019-03-182-4/+0
|
* Documenting feature render in templateLibravatar Vicente Ramirez Perea2019-03-183-0/+10
|
* Add support for loop.lastLibravatar yossyJ2019-01-082-2/+2
|
* Allow trailing commas in tuples (#188)Libravatar yossyJ2019-01-081-1/+1
|
* Add support for tupleLibravatar yossyJ2019-01-042-0/+4
|
* fix rust macro argumentsLibravatar Juan Aguilar Santillana2018-12-131-0/+26
|
* Allow using brackets for enums in `match`Libravatar mcarton2018-12-121-2/+2
|
* Add test for unescaped variable expressions (see #132)Libravatar Qian Linfeng2018-10-201-0/+5
|
* Clean up warning about unused fieldLibravatar Dirkjan Ochtman2018-10-081-1/+1
|
* Add Rust macro support at templatesLibravatar bott2018-10-071-0/+1
|
* fix panicked on range-based for loopLibravatar bott2018-09-211-0/+15
|
* Fix operator preference at loop.indexLibravatar bott2018-09-141-1/+1
|
* Fix operator preference at loop.firstLibravatar bott2018-09-141-0/+3
|
* Fix deep nested imports in macro callsLibravatar bott2018-09-073-2/+8
|
* Fix multiple nesting in macro calls into different scopesLibravatar bott2018-09-021-2/+6
|
* Add test for nested macro calls into different scopeLibravatar bott2018-09-022-0/+9
|
* Add benchmarks to the Askama repoLibravatar Dirkjan Ochtman2018-06-282-0/+20
|
* Add test for 'loop.first' variableLibravatar Dirkjan Ochtman2018-06-251-1/+1
|