mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 13:30:59 +00:00
Move parser and generator code into askama crate
This commit is contained in:
parent
9837efad98
commit
5d193ce822
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -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)",
|
||||
]
|
||||
|
||||
|
@ -6,3 +6,4 @@ workspace = ".."
|
||||
|
||||
[dependencies]
|
||||
htmlescape = { git = "https://github.com/veddan/rust-htmlescape" }
|
||||
nom = "2.0"
|
||||
|
@ -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;
|
||||
|
@ -7,5 +7,5 @@ authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
askama = { path = "../askama" }
|
||||
syn = "0.10"
|
||||
nom = "2.0"
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user