aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-01-07 20:33:29 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-01-07 20:33:29 +0100
commit5d193ce822fab739f889a70c1defa402ddea8eab (patch)
treed9ec0d8998ca9850d879809e66f8037bd3beed1e
parent9837efad983dd0de6439a8c9d59165df01adfe3f (diff)
downloadaskama-5d193ce822fab739f889a70c1defa402ddea8eab.tar.gz
askama-5d193ce822fab739f889a70c1defa402ddea8eab.tar.bz2
askama-5d193ce822fab739f889a70c1defa402ddea8eab.zip
Move parser and generator code into askama crate
Diffstat (limited to '')
-rw-r--r--Cargo.lock3
-rw-r--r--askama/Cargo.toml1
-rw-r--r--askama/src/generator.rs (renamed from askama_derive/src/generator.rs)0
-rw-r--r--askama/src/lib.rs5
-rw-r--r--askama/src/parser.rs (renamed from askama_derive/src/parser.rs)0
-rw-r--r--askama_derive/Cargo.toml2
-rw-r--r--askama_derive/src/lib.rs10
7 files changed, 12 insertions, 9 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 0897e33..53811e7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11,13 +11,14 @@ name = "askama"
version = "0.1.0"
dependencies = [
"htmlescape 0.3.1 (git+https://github.com/veddan/rust-htmlescape)",
+ "nom 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "askama_derive"
version = "0.1.0"
dependencies = [
- "nom 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "askama 0.1.0",
"syn 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
diff --git a/askama/Cargo.toml b/askama/Cargo.toml
index 404f7be..13d718a 100644
--- a/askama/Cargo.toml
+++ b/askama/Cargo.toml
@@ -6,3 +6,4 @@ workspace = ".."
[dependencies]
htmlescape = { git = "https://github.com/veddan/rust-htmlescape" }
+nom = "2.0"
diff --git a/askama_derive/src/generator.rs b/askama/src/generator.rs
index 0e80265..0e80265 100644
--- a/askama_derive/src/generator.rs
+++ b/askama/src/generator.rs
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index 5ce214b..04caf76 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -1,7 +1,12 @@
#![feature(proc_macro)]
+#[macro_use]
+extern crate nom;
+
pub trait Template {
fn render(&self) -> String;
}
pub mod filters;
+pub mod generator;
+pub mod parser;
diff --git a/askama_derive/src/parser.rs b/askama/src/parser.rs
index cd93971..cd93971 100644
--- a/askama_derive/src/parser.rs
+++ b/askama/src/parser.rs
diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml
index e9bfa66..400cbd3 100644
--- a/askama_derive/Cargo.toml
+++ b/askama_derive/Cargo.toml
@@ -7,5 +7,5 @@ authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
proc-macro = true
[dependencies]
+askama = { path = "../askama" }
syn = "0.10"
-nom = "2.0"
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs
index 3b8fe55..8613ead 100644
--- a/askama_derive/src/lib.rs
+++ b/askama_derive/src/lib.rs
@@ -1,13 +1,9 @@
#![feature(proc_macro, proc_macro_lib)]
-#[macro_use]
-extern crate nom;
+extern crate askama;
extern crate proc_macro;
extern crate syn;
-mod generator;
-mod parser;
-
use proc_macro::TokenStream;
use std::fs::File;
use std::io::Read;
@@ -65,6 +61,6 @@ pub fn derive_template(input: TokenStream) -> TokenStream {
let name = &ast.ident;
let path = get_path_from_attrs(&ast.attrs);
let src = get_template_source(&path);
- let tokens = parser::parse(&src);
- generator::generate(name.as_ref(), &tokens).parse().unwrap()
+ let tokens = askama::parser::parse(&src);
+ askama::generator::generate(name.as_ref(), &tokens).parse().unwrap()
}