aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-27 22:10:42 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-27 22:10:42 +0200
commit9f3b590206e3dfe33b7129b1c8ff010f60318cf2 (patch)
tree5411864d92ec220d9d4db8d9e40cda6df9b2b16f /askama_shared
parentaeac47cee0e14b9fa38c01082876667f0ec8d874 (diff)
downloadaskama-9f3b590206e3dfe33b7129b1c8ff010f60318cf2.tar.gz
askama-9f3b590206e3dfe33b7129b1c8ff010f60318cf2.tar.bz2
askama-9f3b590206e3dfe33b7129b1c8ff010f60318cf2.zip
Move most of the code into new askama_shared crate
This makes it possible to share code between askama and askama_derive.
Diffstat (limited to '')
-rw-r--r--askama_shared/Cargo.toml19
-rw-r--r--askama_shared/src/filters/json.rs (renamed from askama/src/filters/json.rs)0
-rw-r--r--askama_shared/src/filters/mod.rs (renamed from askama/src/filters/mod.rs)0
-rw-r--r--askama_shared/src/generator.rs (renamed from askama_derive/src/generator.rs)0
-rw-r--r--askama_shared/src/lib.rs29
-rw-r--r--askama_shared/src/parser.rs (renamed from askama_derive/src/parser.rs)0
-rw-r--r--askama_shared/src/path.rs (renamed from askama_derive/src/path.rs)3
-rw-r--r--askama_shared/templates/a.html (renamed from askama_derive/templates/a.html)0
-rw-r--r--askama_shared/templates/sub/b.html (renamed from askama_derive/templates/sub/b.html)0
-rw-r--r--askama_shared/templates/sub/c.html (renamed from askama_derive/templates/sub/c.html)0
-rw-r--r--askama_shared/templates/sub/sub1/d.html (renamed from askama_derive/templates/sub/sub1/d.html)0
11 files changed, 49 insertions, 2 deletions
diff --git a/askama_shared/Cargo.toml b/askama_shared/Cargo.toml
new file mode 100644
index 0000000..6ad2bff
--- /dev/null
+++ b/askama_shared/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "askama_shared"
+version = "0.3.4"
+authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
+workspace = ".."
+
+[features]
+default = []
+serde-json = ["serde", "serde_json"]
+iron = []
+rocket = []
+
+[dependencies]
+error-chain = "0.10"
+nom = "3"
+quote = "0.3"
+serde = { version = "1.0", optional = true }
+serde_json = { version = "1.0", optional = true }
+syn = "0.11"
diff --git a/askama/src/filters/json.rs b/askama_shared/src/filters/json.rs
index 4443fb4..4443fb4 100644
--- a/askama/src/filters/json.rs
+++ b/askama_shared/src/filters/json.rs
diff --git a/askama/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
index 73b311d..73b311d 100644
--- a/askama/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
diff --git a/askama_derive/src/generator.rs b/askama_shared/src/generator.rs
index 82f3994..82f3994 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_shared/src/generator.rs
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs
new file mode 100644
index 0000000..1ee19cf
--- /dev/null
+++ b/askama_shared/src/lib.rs
@@ -0,0 +1,29 @@
+#[macro_use]
+extern crate error_chain;
+#[macro_use]
+extern crate nom;
+extern crate quote;
+extern crate syn;
+
+#[cfg(feature = "serde-json")]
+extern crate serde;
+#[cfg(feature = "serde-json")]
+extern crate serde_json;
+
+pub use errors::Result;
+pub mod filters;
+pub mod path;
+pub use parser::parse;
+pub use generator::generate;
+
+mod generator;
+mod parser;
+
+mod errors {
+ error_chain! {
+ foreign_links {
+ Fmt(::std::fmt::Error);
+ Json(::serde_json::Error) #[cfg(feature = "serde-json")];
+ }
+ }
+}
diff --git a/askama_derive/src/parser.rs b/askama_shared/src/parser.rs
index 8732f0e..8732f0e 100644
--- a/askama_derive/src/parser.rs
+++ b/askama_shared/src/parser.rs
diff --git a/askama_derive/src/path.rs b/askama_shared/src/path.rs
index 3c04965..86bf6d7 100644
--- a/askama_derive/src/path.rs
+++ b/askama_shared/src/path.rs
@@ -43,8 +43,7 @@ pub fn find_template_from_path<'a>(path: &str, start_at: Option<&Path>) -> PathB
}
}
-// Duplicated in askama
-fn template_dir() -> PathBuf {
+pub fn template_dir() -> PathBuf {
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
path.push("templates");
path
diff --git a/askama_derive/templates/a.html b/askama_shared/templates/a.html
index 257cc56..257cc56 100644
--- a/askama_derive/templates/a.html
+++ b/askama_shared/templates/a.html
diff --git a/askama_derive/templates/sub/b.html b/askama_shared/templates/sub/b.html
index 5716ca5..5716ca5 100644
--- a/askama_derive/templates/sub/b.html
+++ b/askama_shared/templates/sub/b.html
diff --git a/askama_derive/templates/sub/c.html b/askama_shared/templates/sub/c.html
index 7601807..7601807 100644
--- a/askama_derive/templates/sub/c.html
+++ b/askama_shared/templates/sub/c.html
diff --git a/askama_derive/templates/sub/sub1/d.html b/askama_shared/templates/sub/sub1/d.html
index fa11a6a..fa11a6a 100644
--- a/askama_derive/templates/sub/sub1/d.html
+++ b/askama_shared/templates/sub/sub1/d.html