diff -Nru rust-tinytemplate-1.0.2/Cargo.toml rust-tinytemplate-1.0.3/Cargo.toml --- rust-tinytemplate-1.0.2/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-tinytemplate-1.0.3/Cargo.toml 2019-12-26 17:03:50.000000000 +0000 @@ -3,7 +3,7 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g. crates.io) dependencies +# to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're @@ -12,7 +12,7 @@ [package] name = "tinytemplate" -version = "1.0.2" +version = "1.0.3" authors = ["Brook Heisler "] description = "Simple, lightweight template engine" readme = "README.md" @@ -30,7 +30,7 @@ [dependencies.serde_json] version = "1.0" [dev-dependencies.criterion] -version = "0.2" +version = "0.3" [dev-dependencies.serde_derive] version = "1.0" diff -Nru rust-tinytemplate-1.0.2/Cargo.toml.orig rust-tinytemplate-1.0.3/Cargo.toml.orig --- rust-tinytemplate-1.0.2/Cargo.toml.orig 1970-01-01 00:00:00.000000000 +0000 +++ rust-tinytemplate-1.0.3/Cargo.toml.orig 2019-12-26 16:59:57.000000000 +0000 @@ -1,41 +1,27 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies -# -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) - [package] name = "tinytemplate" -version = "1.0.2" +version = "1.0.3" authors = ["Brook Heisler "] + description = "Simple, lightweight template engine" +repository = "https://github.com/bheisler/TinyTemplate" readme = "README.md" +license = "Apache-2.0 OR MIT" keywords = ["template", "html"] categories = ["template-engine"] -license = "Apache-2.0 OR MIT" -repository = "https://github.com/bheisler/TinyTemplate" -[[bench]] -name = "benchmarks" -harness = false -[dependencies.serde] -version = "1.0" +[badges] +travis-ci = { repository = "bheisler/TinyTemplate" } +maintenance = { status = "passively-maintained" } -[dependencies.serde_json] -version = "1.0" -[dev-dependencies.criterion] -version = "0.2" +[dependencies] +serde = "1.0" +serde_json = "1.0" -[dev-dependencies.serde_derive] -version = "1.0" -[badges.maintenance] -status = "passively-maintained" +[dev-dependencies] +serde_derive = "1.0" +criterion = "0.3" -[badges.travis-ci] -repository = "bheisler/TinyTemplate" +[[bench]] +name = "benchmarks" +harness = false diff -Nru rust-tinytemplate-1.0.2/.cargo_vcs_info.json rust-tinytemplate-1.0.3/.cargo_vcs_info.json --- rust-tinytemplate-1.0.2/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 +++ rust-tinytemplate-1.0.3/.cargo_vcs_info.json 2019-12-26 17:03:50.000000000 +0000 @@ -1,5 +1,5 @@ { "git": { - "sha1": "ec1e6e37bdf03d02ca2864a94237b2b1b7bc4d94" + "sha1": "747bc24951d271641957d0eda22b2b50de5e76c2" } } diff -Nru rust-tinytemplate-1.0.2/CHANGELOG.md rust-tinytemplate-1.0.3/CHANGELOG.md --- rust-tinytemplate-1.0.2/CHANGELOG.md 2019-05-17 01:12:29.000000000 +0000 +++ rust-tinytemplate-1.0.3/CHANGELOG.md 2019-12-26 17:00:56.000000000 +0000 @@ -4,7 +4,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.0.3] - 2019-12-26 +### Fixed +- Fixed the @last keyword never evaluating to true +- Fixed numeric values being truthy when zero, rather than when non-zero. ## [1.0.2] - 2019-05-16 ### Fixed @@ -18,5 +21,7 @@ ### Added - Initial release on Crates.io. -[Unreleased]: https://github.com/bheisler/TinyTemplate/compare/1.0.1...HEAD +[Unreleased]: https://github.com/bheisler/TinyTemplate/compare/1.0.3...HEAD [1.0.1]: https://github.com/bheisler/TinyTemplate/compare/1.0.0...1.0.1 +[1.0.2]: https://github.com/bheisler/TinyTemplate/compare/1.0.1...1.0.2 +[1.0.3]: https://github.com/bheisler/TinyTemplate/compare/1.0.2...1.0.3 diff -Nru rust-tinytemplate-1.0.2/debian/cargo-checksum.json rust-tinytemplate-1.0.3/debian/cargo-checksum.json --- rust-tinytemplate-1.0.2/debian/cargo-checksum.json 2019-08-06 16:22:23.000000000 +0000 +++ rust-tinytemplate-1.0.3/debian/cargo-checksum.json 2020-01-01 12:19:12.000000000 +0000 @@ -1 +1 @@ -{"package":"4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20","files":{}} +{"package":"57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a","files":{}} diff -Nru rust-tinytemplate-1.0.2/debian/changelog rust-tinytemplate-1.0.3/debian/changelog --- rust-tinytemplate-1.0.2/debian/changelog 2019-08-06 16:22:23.000000000 +0000 +++ rust-tinytemplate-1.0.3/debian/changelog 2020-01-01 12:19:12.000000000 +0000 @@ -1,3 +1,9 @@ +rust-tinytemplate (1.0.3-1) unstable; urgency=medium + + * Package tinytemplate 1.0.3 from crates.io using debcargo 2.4.0 + + -- Sylvestre Ledru Wed, 01 Jan 2020 13:19:12 +0100 + rust-tinytemplate (1.0.2-2) unstable; urgency=medium * Package tinytemplate 1.0.2 from crates.io using debcargo 2.2.10 diff -Nru rust-tinytemplate-1.0.2/debian/control rust-tinytemplate-1.0.3/debian/control --- rust-tinytemplate-1.0.2/debian/control 2019-08-06 16:22:23.000000000 +0000 +++ rust-tinytemplate-1.0.3/debian/control 2020-01-01 12:19:12.000000000 +0000 @@ -2,7 +2,7 @@ Section: rust Priority: optional Build-Depends: debhelper (>= 11), - dh-cargo (>= 15), + dh-cargo (>= 18), cargo:native , rustc:native , libstd-rust-dev , @@ -28,8 +28,8 @@ librust-tinytemplate-1+default-dev (= ${binary:Version}), librust-tinytemplate-1.0-dev (= ${binary:Version}), librust-tinytemplate-1.0+default-dev (= ${binary:Version}), - librust-tinytemplate-1.0.2-dev (= ${binary:Version}), - librust-tinytemplate-1.0.2+default-dev (= ${binary:Version}) + librust-tinytemplate-1.0.3-dev (= ${binary:Version}), + librust-tinytemplate-1.0.3+default-dev (= ${binary:Version}) Description: Simple, lightweight template engine - Rust source code This package contains the source for the Rust tinytemplate crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-tinytemplate-1.0.2/debian/copyright.debcargo.hint rust-tinytemplate-1.0.3/debian/copyright.debcargo.hint --- rust-tinytemplate-1.0.2/debian/copyright.debcargo.hint 2019-08-06 16:22:23.000000000 +0000 +++ rust-tinytemplate-1.0.3/debian/copyright.debcargo.hint 2020-01-01 12:19:12.000000000 +0000 @@ -21,8 +21,8 @@ Files: debian/* Copyright: - 2019 Debian Rust Maintainers - 2019 Sylvestre Ledru + 2019-2020 Debian Rust Maintainers + 2019-2020 Sylvestre Ledru License: Apache-2.0 or MIT License: Apache-2.0 diff -Nru rust-tinytemplate-1.0.2/debian/tests/control rust-tinytemplate-1.0.3/debian/tests/control --- rust-tinytemplate-1.0.2/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ rust-tinytemplate-1.0.3/debian/tests/control 2020-01-01 12:19:12.000000000 +0000 @@ -0,0 +1,7 @@ +Test-Command: /usr/share/cargo/bin/cargo-auto-test tinytemplate 1.0.3 --all-targets --all-features +Depends: dh-cargo (>= 18), librust-criterion-0.3+default-dev, librust-serde-derive-1+default-dev, @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test tinytemplate 1.0.3 --all-targets --no-default-features +Depends: dh-cargo (>= 18), librust-criterion-0.3+default-dev, librust-serde-derive-1+default-dev, librust-tinytemplate-dev +Restrictions: allow-stderr, skip-not-installable diff -Nru rust-tinytemplate-1.0.2/README.md rust-tinytemplate-1.0.3/README.md --- rust-tinytemplate-1.0.2/README.md 2019-01-26 14:01:56.000000000 +0000 +++ rust-tinytemplate-1.0.3/README.md 2019-12-26 16:52:14.000000000 +0000 @@ -104,9 +104,9 @@ ### Compatibility Policy TinyTemplate supports the last three stable minor releases of Rust. At time of writing, this means -Rust 1.29 or later. Older versions may work, but are not tested or guaranteed. +Rust 1.38 or later. Older versions may work, but are not tested or guaranteed. -Currently, the oldest version of Rust believed to work is 1.26. Future versions of TinyTemplate may +Currently, the oldest version of Rust believed to work is 1.31. Future versions of TinyTemplate may break support for such old versions, and this will not be considered a breaking change. If you require TinyTemplate to work on old versions of Rust, you will need to stick to a specific patch version of TinyTemplate. diff -Nru rust-tinytemplate-1.0.2/src/compiler.rs rust-tinytemplate-1.0.3/src/compiler.rs --- rust-tinytemplate-1.0.2/src/compiler.rs 2019-05-17 01:07:37.000000000 +0000 +++ rust-tinytemplate-1.0.3/src/compiler.rs 2019-12-26 16:42:35.000000000 +0000 @@ -21,7 +21,7 @@ } /// List of the known @-keywords so that we can error if the user spells them wrong. -static KNOWN_KEYWORDS: [&'static str; 3] = ["@index", "@first", "@last"]; +static KNOWN_KEYWORDS: [&str; 3] = ["@index", "@first", "@last"]; /// The TemplateCompiler struct is responsible for parsing a template string and generating bytecode /// instructions based on it. The parser is a simple hand-written pattern-matching parser with no diff -Nru rust-tinytemplate-1.0.2/src/lib.rs rust-tinytemplate-1.0.3/src/lib.rs --- rust-tinytemplate-1.0.2/src/lib.rs 2019-01-26 14:01:56.000000000 +0000 +++ rust-tinytemplate-1.0.3/src/lib.rs 2019-12-26 16:42:20.000000000 +0000 @@ -83,7 +83,7 @@ use template::Template; /// Type alias for closures which can be used as value formatters. -pub type ValueFormatter = Fn(&Value, &mut String) -> Result<()>; +pub type ValueFormatter = dyn Fn(&Value, &mut String) -> Result<()>; /// Appends `value` to `output`, performing HTML-escaping in the process. pub fn escape(value: &str, output: &mut String) { diff -Nru rust-tinytemplate-1.0.2/src/template.rs rust-tinytemplate-1.0.3/src/template.rs --- rust-tinytemplate-1.0.2/src/template.rs 2019-01-26 14:01:56.000000000 +0000 +++ rust-tinytemplate-1.0.3/src/template.rs 2019-12-26 16:31:49.000000000 +0000 @@ -153,7 +153,7 @@ } "@last" => { let (index, length) = render_context.lookup_index()?; - write!(output, "{}", index == length).unwrap() + write!(output, "{}", index == length - 1).unwrap() } _ => panic!(), // This should have been caught by the parser. } @@ -185,7 +185,7 @@ "@first" => render_context.lookup_index()?.0 == 0, "@last" => { let (index, length) = render_context.lookup_index()?; - index == length + index == (length - 1) } _ => panic!(), // This should have been caught by the parser. } @@ -195,7 +195,7 @@ Value::Null => false, Value::Bool(b) => *b, Value::Number(n) => match n.as_f64() { - Some(float) => float == 0.0, + Some(float) => float != 0.0, None => { return Err(truthiness_error(self.original_text, path)); } @@ -551,6 +551,19 @@ } #[test] + fn test_for_loop_last() { + let template = + compile("{{ for a in array }}{{ if @last}}{ @index }{{ endif }}{{ endfor }}"); + let context = context(); + let template_registry = other_templates(); + let formatter_registry = formatters(); + let string = template + .render(&context, &template_registry, &formatter_registry) + .unwrap(); + assert_eq!("2", &string); + } + + #[test] fn test_whitespace_stripping_value() { let template = compile("1 \n\t {- number -} \n 1"); let context = context(); diff -Nru rust-tinytemplate-1.0.2/.travis.yml rust-tinytemplate-1.0.3/.travis.yml --- rust-tinytemplate-1.0.2/.travis.yml 2019-01-26 14:01:56.000000000 +0000 +++ rust-tinytemplate-1.0.3/.travis.yml 2019-12-26 16:51:23.000000000 +0000 @@ -16,9 +16,9 @@ include: - os: linux - os: linux - rust: 1.29.0 + rust: 1.31.0 - os: linux - rust: 1.26.0 + rust: 1.38.0 - os: linux env: RUSTFMT=yes - os: linux