Skip to content

Commit 3b12c53

Browse files
authored
Merge pull request #199 from epage/split
chore: Split into multiple crates
2 parents 4af35eb + f8bf6a1 commit 3b12c53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+987
-585
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ install:
3939
- export PATH=$HOME/.cargo/bin:$PATH
4040

4141
script:
42-
- cargo check --verbose
43-
- cargo check --verbose --no-default-features
42+
- cargo check --verbose --all
4443
- cargo check --verbose --features "cli serde_json object_sorted"
4544
- rm -rf target/debug/deps/*liquid* # Avoid skeptic problems
46-
- cargo test --verbose --features "cli serde_json"
47-
- cargo when --channel nightly bench --features "cli serde_json"
48-
- cargo when --channel stable doc --no-deps --all-features
45+
- cargo test --verbose --all
46+
- cargo when --channel nightly bench --all
47+
- cargo when --channel stable doc --all --no-deps --all-features
4948

5049
after_success:
5150
- cargo when --channel stable coveralls

Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
[workspace]
2+
members = ["liquid-error", "liquid-value", "liquid-compiler", "liquid-interpreter"]
3+
14
[package]
25
name = "liquid"
36
version = "0.15.0"
47
authors = ["Johann Hofmann <[email protected]>"]
58
description = "The liquid templating language for Rust"
69
repository = "https://github.com/cobalt-org/liquid-rust"
7-
documentation = "https://cobalt-org.github.io/liquid-rust/"
10+
documentation = "https://docs.rs/liquid"
811
readme = "README.md"
912
categories = ["template-engine"]
1013
keywords = ["liquid", "template", "templating", "language", "html"]
@@ -24,7 +27,7 @@ doc = false
2427

2528
[features]
2629
default = ["extra-filters", "serde"]
27-
cli = ["clap", "error-chain", "serde_yaml"]
30+
cli = ["clap", "error-chain", "serde_yaml", "serde_json"]
2831
extra-filters = []
2932
# Ensure keys in `Value`s `Object`s to be sorted.
3033
object_sorted = []
@@ -36,6 +39,10 @@ chrono = "0.4"
3639
unicode-segmentation = "1.2"
3740
itertools = "0.7.0"
3841
url = "1.5"
42+
liquid-error = { version = "0.15.0", path = "liquid-error" }
43+
liquid-value = { version = "0.15.0", path = "liquid-value" }
44+
liquid-compiler = { version = "0.15.0", path = "liquid-compiler" }
45+
liquid-interpreter = { version = "0.15.0", path = "liquid-interpreter" }
3946

4047
serde = { version = "1.0", optional = true, features = ["derive"] }
4148
clap = { version = "2.26", optional = true }

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
liquid-rust [![Travis Status](https://travis-ci.org/cobalt-org/liquid-rust.svg?branch=master)](https://travis-ci.org/cobalt-org/liquid-rust) [![Appveyor Status](https://ci.appveyor.com/api/projects/status/n1nqaitd5uja8tsi/branch/master?svg=true)](https://ci.appveyor.com/project/johannhof/liquid-rust/branch/master) [![Crates Status](https://img.shields.io/crates/v/liquid.svg)](https://crates.io/crates/liquid) [![Coverage Status](https://coveralls.io/repos/github/cobalt-org/liquid-rust/badge.svg?branch=master)](https://coveralls.io/github/cobalt-org/liquid-rust?branch=master) [![Dependency Status](https://dependencyci.com/github/cobalt-org/liquid-rust/badge)](https://dependencyci.com/github/cobalt-org/liquid-rust)
1+
liquid-rust
22
===========
33

4-
[Liquid templating](http://liquidmarkup.org/) for Rust
4+
> [Liquid templating](http://liquidmarkup.org/) for Rust
5+
6+
[![Travis Status](https://travis-ci.org/cobalt-org/liquid-rust.svg?branch=master)](https://travis-ci.org/cobalt-org/liquid-rust)
7+
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/n1nqaitd5uja8tsi/branch/master?svg=true)](https://ci.appveyor.com/project/johannhof/liquid-rust/branch/master)
8+
[![Crates Status](https://img.shields.io/crates/v/liquid.svg)](https://crates.io/crates/liquid)
9+
[![Coverage Status](https://coveralls.io/repos/github/cobalt-org/liquid-rust/badge.svg?branch=master)](https://coveralls.io/github/cobalt-org/liquid-rust?branch=master)
10+
[![Dependency Status](https://dependencyci.com/github/cobalt-org/liquid-rust/badge)](https://dependencyci.com/github/cobalt-org/liquid-rust)
511

612
Usage
713
----------
@@ -28,19 +34,15 @@ let template = liquid::ParserBuilder::with_liquid()
2834
.build()
2935
.parse("Liquid! {{num | minus: 2}}").unwrap();
3036

31-
let mut globals = liquid::Object::new();
32-
globals.insert("num".into(), liquid::Value::scalar(4f64));
37+
let mut globals = liquid::value::Object::new();
38+
globals.insert("num".into(), liquid::value::Value::scalar(4f64));
3339

3440
let output = template.render(&globals).unwrap();
3541
assert_eq!(output, "Liquid! 2".to_string());
3642
```
3743

3844
You can find a reference on Liquid syntax [here](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers).
3945

40-
Plugins
41-
--------
42-
Cache block ( File and Redis ) : https://github.com/FerarDuanSednan/liquid-rust-cache
43-
4446
Extending Liquid
4547
--------
4648

appveyor.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ install:
2626
- cargo -V
2727

2828
test_script:
29-
- cargo check --verbose
30-
- cargo check --verbose --no-default-features
29+
- cargo check --verbose --all
3130
- cargo check --verbose --features "cli serde_json object_sorted"
3231
- del target\debug\deps\*liquid* # Avoid skeptic problems
33-
- cargo test --verbose --features "cli serde_json"
32+
- cargo test --verbose --all
3433

3534
branches:
3635
only:

benches/liquid.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn bench_render_text(b: &mut test::Bencher) {
2020
.parse(TEXT_ONLY)
2121
.expect("Benchmark template parsing failed");
2222

23-
let data = liquid::Object::new();
23+
let data = liquid::value::Object::new();
2424

2525
b.iter(|| template.render(&data));
2626
}
@@ -49,7 +49,7 @@ fn bench_render_variable(b: &mut test::Bencher) {
4949
.parse(VARIABLE_ONLY)
5050
.expect("Benchmark template parsing failed");
5151

52-
let data: liquid::Object =
52+
let data: liquid::value::Object =
5353
serde_yaml::from_str(VARIABLE_ONLY_OBJECT).expect("Benchmark object parsing failed");
5454

5555
b.iter(|| template.render(&data));
@@ -97,7 +97,7 @@ fn bench_render_template(b: &mut test::Bencher) {
9797
.parse(ITERATE)
9898
.expect("Benchmark template parsing failed");
9999

100-
let data: liquid::Object =
100+
let data: liquid::value::Object =
101101
serde_yaml::from_str(ITERATE_OBJECT).expect("Benchmark object parsing failed");
102102

103103
b.iter(|| template.render(&data));

liquid-compiler/CHANGELOG.md

Whitespace-only changes.

liquid-compiler/Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "liquid-compiler"
3+
version = "0.15.0"
4+
authors = ["Johann Hofmann <[email protected]>"]
5+
description = "The liquid templating language for Rust"
6+
repository = "https://github.com/cobalt-org/liquid-rust/tree/master/liquid-compiler"
7+
documentation = "https://docs.rs/liquid-compiler"
8+
readme = "README.md"
9+
categories = ["template-engine"]
10+
keywords = ["liquid", "template", "templating", "language", "html"]
11+
license = "MIT"
12+
13+
[badges]
14+
travis-ci = { repository = "cobalt-org/liquid-rust" }
15+
appveyor = { repository = "johannhof/liquid-rust" }
16+
17+
[dependencies]
18+
regex = "1.0"
19+
lazy_static = "1.0"
20+
# Exposed in API
21+
liquid-error = { version = "0.15.0", path = "../liquid-error" }
22+
liquid-value = { version = "0.15.0", path = "../liquid-value" }
23+
liquid-interpreter = { version = "0.15.0", path = "../liquid-interpreter" }

liquid-compiler/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 cobalt-org
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

liquid-compiler/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
liquid-compiler
2+
===========
3+
4+
> [Liquid templating](http://liquidmarkup.org/) for Rust
5+
6+
[![Travis Status](https://travis-ci.org/cobalt-org/liquid-rust.svg?branch=master)](https://travis-ci.org/cobalt-org/liquid-rust)
7+
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/n1nqaitd5uja8tsi/branch/master?svg=true)](https://ci.appveyor.com/project/johannhof/liquid-rust/branch/master)
8+
[![Crates Status](https://img.shields.io/crates/v/liquid.svg)](https://crates.io/crates/liquid)
9+
[![Coverage Status](https://coveralls.io/repos/github/cobalt-org/liquid-rust/badge.svg?branch=master)](https://coveralls.io/github/cobalt-org/liquid-rust?branch=master)
10+
[![Dependency Status](https://dependencyci.com/github/cobalt-org/liquid-rust/badge)](https://dependencyci.com/github/cobalt-org/liquid-rust)
11+
12+
Usage
13+
----------
14+
15+
To include liquid in your project add the following to your Cargo.toml:
16+
17+
```toml
18+
[dependencies]
19+
liquid-compiler = "0.15"
20+
```
21+
22+
Now you can use the crate in your code:
23+
24+
```rust
25+
extern crate liquid_compiler;
26+
```

src/compiler/block.rs renamed to liquid-compiler/src/block.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
use liquid_interpreter::Renderable;
2+
3+
use super::error::Result;
14
use super::Element;
25
use super::LiquidOptions;
3-
use super::Result;
46
use super::Token;
5-
use interpreter::Renderable;
67

78
/// A trait for creating custom custom block-size tags (`{% if something %}{% endif %}`).
89
/// This is a simple type alias for a function.
@@ -45,11 +46,11 @@ pub type FnParseBlock = fn(&str, &[Token], &[Element], &LiquidOptions) -> Result
4546

4647
#[derive(Clone)]
4748
struct FnBlockParser {
48-
pub parser: FnParseBlock,
49+
parser: FnParseBlock,
4950
}
5051

5152
impl FnBlockParser {
52-
pub fn new(parser: FnParseBlock) -> Self {
53+
fn new(parser: FnParseBlock) -> Self {
5354
Self { parser }
5455
}
5556
}

0 commit comments

Comments
 (0)