use crate::ToYew;
use notedown_ast::AST;
use notedown_ast::utils::indent;

pub fn check_bare_text(s: &AST) -> String {
    match s {
        AST::Text(t) => format!("{{{:?}}}", t),
        _ => s.to_yew(),
    }
}

pub fn view_function(input: &str) -> String {
    format!(
        "use crate::symbols::*;\npub fn view() -> Html {{\n    html! {{\n{}    }}\n}}",
        indent(input, 4)
    )
}


/*
pub fn check_bare_span(s: &Span) -> String {
    match s {
        Span::Text(t) => format!("{{\"{}\"}}", t.to_yew()),
        _ => s.to_yew(),
    }
}

pub fn format_list(elements: &[ListItem], start_tag: &str, end_tag: &str) -> String {
    let mut ret = String::new();
    for list_item in elements {
        let mut content = String::new();
        content.push_str(&list_item.to_yew());
        ret.push_str(&format!("\n<li>{}</li>\n", content))
    }
    format!("<{}>{}</{}>\n\n", start_tag, ret, end_tag)
}
*/