use crate::codegen::syntax_tree_pysql::{Name, NodeType, ToHtml};
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ForEachNode {
pub childs: Vec<NodeType>,
pub collection: String,
pub index: String,
pub item: String,
}
impl Name for ForEachNode {
fn name() -> &'static str {
"for"
}
}
impl ToHtml for ForEachNode {
fn as_html(&self) -> String {
let mut childs = String::new();
for x in &self.childs {
childs.push_str(&x.as_html());
}
format!(
"<foreach collection=\"{}\" index=\"{}\" item=\"{}\" >{}</foreach>",
self.collection, self.index, self.item, childs
)
}
}