Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/export #8

Merged
merged 21 commits into from
Jul 14, 2023
Prev Previous commit
Next Next commit
fixed header and footer
  • Loading branch information
yplog committed Jul 13, 2023
commit 756093f7eed0a2aefa4bb6303146497905668822
8 changes: 4 additions & 4 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn print_result<T, E>(result: Result<T, E>) -> Result<(), io::Error> {
}

pub fn generate_html(groups: HashMap<NaiveDate, Vec<models::Todo>>) {
const HEADER: &str = r#"<!DOCTYPE html>
let header: &str = r#"<!DOCTYPE html>
<html lang="en">

<head>
Expand All @@ -82,12 +82,12 @@ pub fn generate_html(groups: HashMap<NaiveDate, Vec<models::Todo>>) {

"#;

const FOOTER: &str = r#"
let footer: &str = r#"
</body>
</html>
"#;

let mut content = HEADER.to_owned();
let mut content = header.to_owned();

for (date, todos) in groups.iter() {
let h1 = format!(
Expand All @@ -112,7 +112,7 @@ pub fn generate_html(groups: HashMap<NaiveDate, Vec<models::Todo>>) {
}
}

content.push_str(FOOTER);
content.push_str(footer);

println!("{}", content);
}
Expand Down