René Kijewski
8c02e48cdb
Implement feature "nightly-spans"
2025-08-19 17:41:20 +02:00
René Kijewski
a0d99ba6fc
Better spans
2025-08-19 17:41:20 +02:00
René Kijewski
29d62fef30
Correct subspan for source = ..
templates
2025-08-19 17:41:20 +02:00
René Kijewski
81252cd0a2
parser: make State
part of InputStream
2025-08-19 17:41:20 +02:00
René Kijewski
e5189b933d
Use Parser::[with_]span()
to generate proc_macro::Span
2025-08-19 17:41:20 +02:00
René Kijewski
27e7ff4fd5
parser(non-working commit!): remove lifetimes from [With]Span
2025-08-19 17:41:20 +02:00
Guillaume Gomez
c335f99106
Merge pull request #576 from GuillaumeGomez/add-missing-for-docs
...
Add missing documentation about for loop features
2025-08-18 16:12:15 +02:00
Guillaume Gomez
acce36cede
Add missing documentation about for loop features
2025-08-18 14:38:28 +02:00
Guillaume Gomez
112a9b1552
Fix some code examples annotations
2025-08-18 12:58:24 +02:00
Guillaume Gomez
1f31021632
Fix wrong macro argument parsing
2025-08-17 16:28:45 +02:00
Guillaume Gomez
e8d2391d48
Allow to ignore jinja code example check
2025-08-17 14:59:12 +02:00
Guillaume Gomez
1da2840071
Fix book code examples
2025-08-17 14:59:12 +02:00
Guillaume Gomez
edcaa61fb6
Add new test to check syntax of book examples
2025-08-17 14:59:12 +02:00
Guillaume Gomez
06d6ec37f6
Merge pull request #573 from Kijewski/pr-linkfix
...
readme: fix a link, include readmes in `lib.rs`
2025-08-16 21:03:27 +02:00
René Kijewski
016fe82199
readme: fix a link, include readmes in lib.rs
2025-08-15 13:06:10 +02:00
Markus Ebner
59a982028e
Fix #563 : filesizeformat with proper accuracy
2025-08-13 12:26:25 +02:00
Guillaume Gomez
e40da12343
Merge pull request #569 from GuillaumeGomez/old-paths
...
Fix invalid handling of paths starting with `::`
2025-08-13 11:39:04 +02:00
Guillaume Gomez
e8572f4580
Fix invalid handling of paths starting with ::
2025-08-13 11:20:49 +02:00
dependabot[bot]
680121125a
build(deps): bump actions/checkout from 4 to 5
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v4...v5 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: '5'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2025-08-12 14:55:17 +02:00
Guillaume Gomez
885e0f7de1
Fix wrong span context for askama variables
2025-08-12 14:54:51 +02:00
Guillaume Gomez
756717c2f7
Merge pull request #560 from Kijewski/pr-inputstream
...
parser: use `LocatingSlice<&str>` instead of `&str`
2025-08-08 11:59:40 +02:00
René Kijewski
1014b975cd
Fix new clippy warnings
2025-08-07 20:55:28 +02:00
René Kijewski
98ad5d5b3f
parser: better messages for (group)
2025-08-07 20:48:15 +02:00
René Kijewski
c0d6f0f0fc
parser: a little better spans
2025-08-07 20:39:38 +02:00
René Kijewski
329771152d
parser: use LocatingSlice<&str>
instead of &str
...
This will enable better span getting in subsequent PRs.
2025-08-07 18:41:51 +02:00
Guillaume Gomez
e9021aa1a5
Merge pull request #557 from Kijewski/pr-rustc_hash
...
parser/derive: use only one hasher throughout the proc_macro
2025-08-06 21:05:53 +02:00
René Kijewski
267a115672
parser/derive: use only one hasher throughout the proc_macro
2025-08-06 20:41:20 +02:00
René Kijewski
3a677870d9
derive: remove unneeded .to_string()
call
...
The invocation is not only bad for performance, but also not necessarily
correct:
* The output of `TokenStream::to_string()` is free to add spaces between
`self` and `.`, or before `self`.
* The `.` might belong to `..` or `..=`.
2025-08-06 19:11:26 +02:00
René Kijewski
58bb4d921f
derive: remove trait BufferFmt
2025-08-06 19:11:26 +02:00
René Kijewski
f62cdfb49a
derive: better spans for Target
2025-08-06 19:11:26 +02:00
René Kijewski
e1eeb815ea
derive: minor macro clean-ups
...
* prefix temporaries in `{{ expr }}` with `__askama`
* replace custom `spanned!(..)` with `quote_spanned!(..)`
* replace `buf.write_tokens(quote_spanned!(..))` with `quote_into!(..)`
2025-08-06 19:11:26 +02:00
René Kijewski
693f86d1c4
derive: don't use format_args!
for code formatting
...
* No need to manually escape raw identifiers
* Allow a few warnings
2025-08-06 19:11:26 +02:00
Guillaume Gomez
7dbbe397f9
Fix clippy lints
2025-08-06 19:11:26 +02:00
Guillaume Gomez
da850d736f
Implement print = "code"
on enums
2025-08-06 19:11:26 +02:00
Guillaume Gomez
80a4af7f2d
Generate a TokenStream
rather than a String
2025-08-06 19:11:26 +02:00
Guillaume Gomez
89024013dd
Put Raw::lit
field into a span
2025-08-06 19:11:26 +02:00
Guillaume Gomez
54be12a6e0
Add missing span information for parsing error
2025-08-06 19:11:26 +02:00
Guillaume Gomez
dd5e21f1de
Merge pull request #555 from seijikun/mr-docs
...
Minor documentation fixes
2025-08-01 17:20:17 +02:00
Markus Ebner
e2da496855
Minor documentation fixes
2025-08-01 17:14:42 +02:00
Guillaume Gomez
ea947736a5
Merge pull request #554 from seijikun/mr-docs
...
Improve documentation
2025-08-01 10:57:35 +02:00
Markus Ebner
4959191aca
Improve documentation
...
- Reference the HtmlSafe trait for nested templates
- Document new call expression syntax for macro invocations
- Show nested macro caller aliasing
- Document parallel frontend for faster debug recompile times
2025-08-01 02:27:29 +02:00
René Kijewski
1f3c926c58
parser: r#self
is not a valid raw identifier in macro calls
...
It's not a valid raw identifier anywhere, actually, but the other cases
(in a path, as a field name, as a macro name) were already handled.
Resolves <https://issues.oss-fuzz.com/issues/435218013 >.
2025-07-31 18:46:35 +02:00
Guillaume Gomez
d12afffc26
Merge pull request #546 from Kijewski/pr-relative-path
...
derive: track included files with relative path
2025-07-31 14:37:11 +02:00
René Kijewski
6035ffb013
derive: track included files with relative path
...
To make the compiler understand which files contributed to the generated
code, in order to make it aware when a recompilation is needed, we track
the file paths using `include_bytes!()` calls in the generated code.
This can be a problem for reproducible builds, because the working
directory contributes to the file hash.
This PR makes Askama generate relative paths if possible. This is always
possible on Unix systems, but on Windows hosts absolute paths have to be
used if the code is kept on different drives.
2025-07-30 19:21:09 +02:00
René Kijewski
e1fb7ee98b
derive: copy path_clean::clean()
and pathdiff::diff_paths()
...
The function `clean()` was copied from the project [`path_clean`] in version 1.0.1 (rev. [`d8948ae`]).
License: MIT OR Apache-2.0.
Authors: Dan Reeves <hey@danreev.es>, Alex Guerra <alex@heyimalex.com>, Adam Reichold
The function `diff_paths()` was copied in from the project [`pathdiff`] in version 0.2.3 (rev. [`5180ff5`]).
License: MIT OR Apache-2.0.
Copyright 2012-2015 The Rust Project Developers.
Please see their commit history for more information.
[`path_clean`]: <https://github.com/danreeves/path-clean >
[`pathdiff`]: <https://github.com/Manishearth/pathdiff >
[`d8948ae`]: <d8948ae69d/src/lib.rs (L50-L86)
>
[`5180ff5`]: <5180ff5b23/src/lib.rs (L18-L86)
>
2025-07-30 19:05:45 +02:00
René Kijewski
d670d9b91c
parser: fail on unterminated byte literal
...
Resolves <https://issues.oss-fuzz.com/issues/433650278 >.
Also, I noticed that an Unicode escape in a byte literal, e.g.
`b'\u{42}'`, was accepted when it should not have been.
2025-07-28 21:56:40 +02:00
Guillaume Gomez
ec17ed4813
Merge pull request #548 from Kijewski/pr-fix-rtd
...
book: first install mdbook, then use it
2025-07-28 20:56:27 +02:00
René Kijewski
c00a774ed2
book: first install mdbook, then use it
...
This is follow up to [#544 ], which makes `update-theme.py` use `mdbook`
itself to build `index.hbs`. `mdbook` needs to be installed to be used,
though.
[#544 ]: <https://redirect.github.com/askama-rs/askama/pull/544 >
2025-07-28 19:58:22 +02:00
Guillaume Gomez
7d2d7a2b59
Merge pull request #544 from Kijewski/pr-update-mdbook
...
book: update `mdbook` version and highlight `jinja` blocks
2025-07-28 17:31:34 +02:00
Guillaume Gomez
11da13eeb8
Merge pull request #543 from Kijewski/143907
...
parser: remove one indirection in `punction()` finding
2025-07-28 17:30:57 +02:00