Update dependencies
This commit is contained in:
@@ -45,8 +45,8 @@ impl Historian {
|
||||
let site_config = match fs::metadata(&toml_path) {
|
||||
Err(_) => Table::new(),
|
||||
Ok(_) => {
|
||||
let toml_data = fs::read(&toml_path).unwrap();
|
||||
toml::de::from_slice(&toml_data).unwrap()
|
||||
let toml_data = fs::read_to_string(&toml_path).unwrap();
|
||||
toml::de::from_str(&toml_data).unwrap()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -532,9 +532,9 @@ fn export_wiki_page(historian: &Historian, renderer: &PageRenderer, name: &str,
|
||||
};
|
||||
|
||||
println!("export: {} to {:?}", page.full_name, page_html_output_path);
|
||||
let page_html = renderer.render_page_template("page.html", historian, &page, toml! {
|
||||
let page_html = renderer.render_page_template("page.html", historian, &page, &toml! {
|
||||
dynamic = false
|
||||
}.as_table().unwrap()).replace(".md", ".html");
|
||||
}).replace(".md", ".html");
|
||||
|
||||
let mut page_html_file = fs::File::create(page_html_output_path).unwrap();
|
||||
page_html_file.write_all(page_html.as_bytes());
|
||||
@@ -545,7 +545,6 @@ fn export_wiki_page(historian: &Historian, renderer: &PageRenderer, name: &str,
|
||||
}
|
||||
|
||||
for child in page.children {
|
||||
// let child_path = page_path.join(child);
|
||||
export_wiki_page(historian, renderer, child.path.to_str().unwrap(), output_path);
|
||||
}
|
||||
}
|
||||
|
||||
30
src/main.rs
30
src/main.rs
@@ -43,17 +43,17 @@ async fn page<'r>(
|
||||
for (key, value) in query.segments() {
|
||||
if key == "action" {
|
||||
if value == "edit" {
|
||||
return PageResponder::Page(RawHtml(renderer.render_page_template("edit.html", &historian, &page, toml! {
|
||||
return PageResponder::Page(RawHtml(renderer.render_page_template("edit.html", &historian, &page, &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())))
|
||||
})))
|
||||
} else if value == "history" {
|
||||
return PageResponder::Page(RawHtml(renderer.template("history.html")
|
||||
.with_historian(&historian)
|
||||
.with_page(&page)
|
||||
.insert("revisions", &historian.get_history_of_page(&page))
|
||||
.insert("options", toml! {
|
||||
.insert("options", &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())
|
||||
})
|
||||
.render()))
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,9 @@ async fn page<'r>(
|
||||
.with_page(&page)
|
||||
.insert("revision", &revision)
|
||||
.insert("content", &historian.get_page_text_of_revision(&page, &revision).unwrap())
|
||||
.insert("options", toml! {
|
||||
.insert("options", &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())
|
||||
})
|
||||
.render()))
|
||||
}
|
||||
}
|
||||
@@ -77,9 +77,9 @@ async fn page<'r>(
|
||||
if page.is_directory && !origin.path().ends_with("/") {
|
||||
PageResponder::Redirect(Redirect::to(origin.path().as_str().to_owned() + "/"))
|
||||
} else {
|
||||
PageResponder::Page(RawHtml(renderer.render_page(&historian, &page, toml! {
|
||||
PageResponder::Page(RawHtml(renderer.render_page(&historian, &page, &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())))
|
||||
})))
|
||||
}
|
||||
}).or_else(|| {
|
||||
if let Some(query) = origin.query() {
|
||||
@@ -91,9 +91,9 @@ async fn page<'r>(
|
||||
.insert("page", &historian.start_page(path_str))
|
||||
.insert("content", "")
|
||||
.insert("ancestors", &Vec::<String>::with_capacity(0))
|
||||
.insert("options", toml! {
|
||||
.insert("options", &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())
|
||||
})
|
||||
.render())))
|
||||
}
|
||||
}
|
||||
@@ -135,9 +135,9 @@ fn action(
|
||||
.insert("subaction", action.subaction)
|
||||
.insert("summary", action.summary)
|
||||
.insert("author", action.author)
|
||||
.insert("options", toml! {
|
||||
.insert("options", &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())
|
||||
})
|
||||
.render()))
|
||||
} else {
|
||||
historian.submit_edit(&page, &Edit {
|
||||
@@ -159,12 +159,12 @@ fn action(
|
||||
}
|
||||
}
|
||||
|
||||
PageResponder::Page(RawHtml(renderer.render_template("message.html", &historian, toml! {
|
||||
PageResponder::Page(RawHtml(renderer.render_template("message.html", &historian, &toml! {
|
||||
header = "Invalid Action"
|
||||
message = "Action was invalid or misunderstood"
|
||||
}.as_table().unwrap(), toml! {
|
||||
}, &toml! {
|
||||
dynamic = true
|
||||
}.as_table().unwrap())))
|
||||
})))
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
|
||||
Reference in New Issue
Block a user