Merge branch 'master' into stable
This commit is contained in:
commit
5618884ae8
|
@ -1,3 +1,10 @@
|
|||
<a name="v0.3.3"></a>
|
||||
## [v0.3.3](https://github.com/Kogia-sima/sailfish/compare/v0.3.2...v0.3.3) (2021-04-06)
|
||||
|
||||
## Fix
|
||||
|
||||
* Improve error message for missing semicolon in code blocks
|
||||
|
||||
<a name="v0.3.2"></a>
|
||||
## [v0.3.2](https://github.com/Kogia-sima/sailfish/compare/v0.3.1...v0.3.2) (2021-03-29)
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "integration-tests"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"pretty_assertions",
|
||||
"sailfish",
|
||||
|
@ -135,9 +135,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.18"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
||||
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
@ -168,7 +168,7 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
|||
|
||||
[[package]]
|
||||
name = "sailfish"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"itoap",
|
||||
"ryu",
|
||||
|
@ -180,7 +180,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sailfish-compiler"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"filetime",
|
||||
"home",
|
||||
|
@ -194,7 +194,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sailfish-macros"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"sailfish-compiler",
|
||||
|
@ -233,9 +233,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.30"
|
||||
version = "1.0.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93a56fabc59dce20fe48b6c832cc249c713e7ed88fa28b0ee0a3bfcaae5fe4e2"
|
||||
checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -32,7 +32,7 @@ Dependencies:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
sailfish = "0.3.2"
|
||||
sailfish = "0.3.3"
|
||||
```
|
||||
|
||||
Template file (templates/hello.stpl):
|
||||
|
|
|
@ -4,7 +4,7 @@ In order to use sailfish templates, you have add two dependencies in your `Cargo
|
|||
|
||||
``` toml
|
||||
[dependencies]
|
||||
sailfish = "0.3.2"
|
||||
sailfish = "0.3.3"
|
||||
```
|
||||
|
||||
## Feature Flags
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sailfish-examples"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Ryohei Machida <orcinus4627@gmail.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "sailfish-compiler"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Ryohei Machida <orcinus4627@gmail.com>"]
|
||||
description = "Really fast, intuitive template engine for Rust"
|
||||
description = "Simple, small, and extremely fast template engine for Rust"
|
||||
homepage = "https://github.com/Kogia-sima/sailfish"
|
||||
repository = "https://github.com/Kogia-sima/sailfish"
|
||||
readme = "../README.md"
|
||||
|
@ -34,7 +34,7 @@ default-features = false
|
|||
features = ["parsing", "full", "visit-mut", "printing"]
|
||||
|
||||
[dependencies.proc-macro2]
|
||||
version = ">=1.0.11, <=1.0.24"
|
||||
version = ">=1.0.11, <=1.0.26"
|
||||
default-features = false
|
||||
features = ["span-locations"]
|
||||
|
||||
|
|
|
@ -116,6 +116,14 @@ impl SourceBuilder {
|
|||
fn write_text<'a>(&mut self, token: &Token<'a>) -> Result<(), Error> {
|
||||
use std::fmt::Write;
|
||||
|
||||
// if error has occured at the first byte of `render_text!` macro, it
|
||||
// will be mapped to the first byte of text
|
||||
self.source_map.entries.push(SourceMapEntry {
|
||||
original: token.offset(),
|
||||
new: self.source.len(),
|
||||
length: 1,
|
||||
});
|
||||
|
||||
self.source.push_str("__sf_rt::render_text!(__sf_buf, ");
|
||||
// write text token with Debug::fmt
|
||||
write!(self.source, "{:?}", token.as_str()).unwrap();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "sailfish-macros"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Ryohei Machida <orcinus4627@gmail.com>"]
|
||||
description = "Really fast, intuitive template engine for Rust"
|
||||
description = "Simple, small, and extremely fast template engine for Rust"
|
||||
homepage = "https://github.com/Kogia-sima/sailfish"
|
||||
repository = "https://github.com/Kogia-sima/sailfish"
|
||||
readme = "../README.md"
|
||||
|
@ -30,6 +30,6 @@ proc-macro2 = "1.0.11"
|
|||
|
||||
[dependencies.sailfish-compiler]
|
||||
path = "../sailfish-compiler"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
default-features = false
|
||||
features = ["procmacro"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "fuzzing-tests"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Ryohei Machida <orcinus4627@gmail.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "integration-tests"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Kogia-sima <orcinus4627@gmail.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
use sailfish::TemplateOnce;
|
||||
use sailfish_macros::TemplateOnce;
|
||||
|
||||
#[derive(TemplateOnce)]
|
||||
#[template(path = "missing_semicolon.stpl")]
|
||||
struct MissingSemicolon {}
|
||||
|
||||
fn main() {
|
||||
println!("{}", (MissingSemicolon {}).render_once().unwrap());
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
error: Failed to compile template.
|
||||
caused by: Rust Syntax Error (unexpected token)
|
||||
|
||||
file: missing_semicolon.stpl
|
||||
position: line 1, column 17
|
||||
|
||||
|
|
||||
1 | <div><% "foo" %></div>
|
||||
| ^
|
||||
|
||||
--> $DIR/missing_semicolon.rs:4:10
|
||||
|
|
||||
4 | #[derive(TemplateOnce)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no method named `render_once` found for struct `MissingSemicolon` in the current scope
|
||||
--> $DIR/missing_semicolon.rs:9:42
|
||||
|
|
||||
6 | struct MissingSemicolon {}
|
||||
| ----------------------- method `render_once` not found for this
|
||||
...
|
||||
9 | println!("{}", (MissingSemicolon {}).render_once().unwrap());
|
||||
| ^^^^^^^^^^^ method not found in `MissingSemicolon`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
= note: the following trait defines an item `render_once`, perhaps you need to implement it:
|
||||
candidate #1: `TemplateOnce`
|
||||
|
||||
warning: unused import: `sailfish::TemplateOnce`
|
||||
--> $DIR/missing_semicolon.rs:1:5
|
||||
|
|
||||
1 | use sailfish::TemplateOnce;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unused_imports)]` on by default
|
|
@ -0,0 +1 @@
|
|||
<div><% "foo" %></div>
|
|
@ -1,5 +1,5 @@
|
|||
error: Failed to compile template.
|
||||
caused by: Rust Syntax Error (LexError)
|
||||
caused by: Rust Syntax Error (lex error)
|
||||
|
||||
file: unbalanced_brace.stpl
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[package]
|
||||
name = "sailfish"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Ryohei Machida <orcinus4627@gmail.com>"]
|
||||
description = "Really fast, intuitive template engine for Rust"
|
||||
description = "Simple, small, and extremely fast template engine for Rust"
|
||||
homepage = "https://github.com/Kogia-sima/sailfish"
|
||||
repository = "https://github.com/Kogia-sima/sailfish"
|
||||
readme = "../README.md"
|
||||
|
@ -29,7 +29,7 @@ serde_json = { version = "1.0.53", optional = true }
|
|||
|
||||
[dependencies.sailfish-macros]
|
||||
path = "../sailfish-macros"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
optional = true
|
||||
|
||||
[build-dependencies]
|
||||
|
|
Loading…
Reference in New Issue