Skip to content

Commit

Permalink
feat: implementing jinja templater
Browse files Browse the repository at this point in the history
  • Loading branch information
benfdking committed Nov 23, 2024
1 parent c5b87d9 commit ddc8c92
Show file tree
Hide file tree
Showing 5 changed files with 1,251 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ name = "depth_map"
harness = false

[features]
default = ["python"]
serde = ["dep:serde"]
stringify = ["dep:serde_yaml", "serde"]
python = ["pyo3"]
Expand Down
5 changes: 5 additions & 0 deletions crates/lib/src/templaters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ use crate::core::config::FluffConfig;
use crate::templaters::placeholder::PlaceholderTemplater;
use crate::templaters::raw::RawTemplater;

#[cfg(feature = "python")]
use crate::templaters::jinja::JinjaTemplater;
#[cfg(feature = "python")]
use crate::templaters::python::PythonTemplater;

#[cfg(feature = "python")]
pub mod jinja;
pub mod placeholder;
#[cfg(feature = "python")]
pub mod python;
Expand All @@ -21,6 +25,7 @@ pub fn templaters() -> Vec<Box<dyn Templater>> {
Box::new(RawTemplater),
Box::new(PlaceholderTemplater),
Box::new(PythonTemplater),
Box::new(JinjaTemplater),
]
}

Expand Down
26 changes: 26 additions & 0 deletions crates/lib/src/templaters/jinja.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use super::Templater;

pub struct JinjaTemplater;

impl Templater for JinjaTemplater {
fn name(&self) -> &'static str {
"jinja"
}

fn description(&self) -> &'static str {
todo!()
}

fn process(
&self,
in_str: &str,
f_name: &str,
config: Option<&crate::core::config::FluffConfig>,
formatter: Option<&crate::cli::formatters::OutputStreamFormatter>,
) -> Result<
sqruff_lib_core::templaters::base::TemplatedFile,
sqruff_lib_core::errors::SQLFluffUserError,
> {
todo!()
}
}
Loading

0 comments on commit ddc8c92

Please sign in to comment.