This commit is contained in:
parent
54b4d7b475
commit
0187f147aa
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -527,7 +527,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "risp"
|
name = "risp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.hofer.link/philipp/risp.git#0dc59cea16e057c60989a0ab1faea605fadb90f8"
|
source = "git+https://git.hofer.link/philipp/risp.git#f47f7c83f215654171b78231c8d7a4192b5e9288"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"directories",
|
"directories",
|
||||||
|
@ -7,3 +7,4 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
risp = {git="https://git.hofer.link/philipp/risp.git", version="0.1"}
|
risp = {git="https://git.hofer.link/philipp/risp.git", version="0.1"}
|
||||||
|
#risp = {path="/home/philipp/priv/risp", version="0.1"}
|
||||||
|
10
src/law.rs
10
src/law.rs
@ -65,14 +65,12 @@ fn print_header(header: Heading, level: usize) -> String {
|
|||||||
header_title
|
header_title
|
||||||
));
|
));
|
||||||
|
|
||||||
match header.content {
|
for content in header.content {
|
||||||
|
match content {
|
||||||
HeadingContent::Paragraph(p) => {
|
HeadingContent::Paragraph(p) => {
|
||||||
for section in p {
|
ret.push_str(&print_paragraph(p));
|
||||||
ret.push_str(&print_paragraph(section));
|
|
||||||
}
|
}
|
||||||
}
|
HeadingContent::Heading(subheader) => {
|
||||||
HeadingContent::Heading(subheaders) => {
|
|
||||||
for subheader in subheaders {
|
|
||||||
ret.push_str(&print_header(subheader, level + 1));
|
ret.push_str(&print_header(subheader, level + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ fn create_index(content: &str) {
|
|||||||
let mut index = fs::read_to_string("templates/index.html").unwrap();
|
let mut index = fs::read_to_string("templates/index.html").unwrap();
|
||||||
index = index.replace("{{content}}", content);
|
index = index.replace("{{content}}", content);
|
||||||
let index = Parts::new().perform(index);
|
let index = Parts::new().perform(index);
|
||||||
fs::write("output/index.html", &index).expect("Unable to write file");
|
fs::write("output/index.html", index).expect("Unable to write file");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Copies all files from `templates/static` to `output`
|
/// Copies all files from `templates/static` to `output`
|
||||||
|
@ -10,7 +10,7 @@ impl Parts {
|
|||||||
let parts_path = Path::new("templates/parts");
|
let parts_path = Path::new("templates/parts");
|
||||||
for part in fs::read_dir(parts_path).expect("No templates/parts folder") {
|
for part in fs::read_dir(parts_path).expect("No templates/parts folder") {
|
||||||
let part = part.unwrap();
|
let part = part.unwrap();
|
||||||
let filename = format!("{}", part.file_name().into_string().unwrap());
|
let filename = part.file_name().into_string().unwrap().to_string();
|
||||||
let filename = filename.replace(".html", "");
|
let filename = filename.replace(".html", "");
|
||||||
let path = format!("{}", part.path().display());
|
let path = format!("{}", part.path().display());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user