mdsplit: the works inside one file, and the books inside scripture

This commit is contained in:
funkpower
2026-09-19 14:58:54 -04:00
parent fb63b3f9ac
commit ea0a3694b1
41 changed files with 2974 additions and 1 deletions
+17 -1
View File
@@ -19,7 +19,7 @@ type Written = Result<Vec<String>, String>;
type Job = (&'static str, fn() -> Written);
fn main() -> ExitCode {
let jobs: [Job; 14] = [
let jobs: [Job; 15] = [
("tokens", tokens),
("unescape", unescape),
("chunkmd", chunkmd),
@@ -34,6 +34,7 @@ fn main() -> ExitCode {
("slug", slug),
("author", author),
("vocab", vocab),
("mdsplit", mdsplit),
];
for (name, job) in jobs {
@@ -77,6 +78,21 @@ fn unescape() -> Written {
Ok(vec![path.display().to_string()])
}
fn mdsplit() -> Written {
let dir = parity::golden("mdsplit");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
let mut written = Vec::new();
for case in parity::cases("mdsplit") {
let markdown = std::fs::read_to_string(&case).map_err(|e| e.to_string())?;
let sections = parity::run_oracle("mdsplit.py", &markdown)?;
let path = dir.join(format!("{}.json", parity::case_name(&case)));
std::fs::write(&path, sections).map_err(|e| e.to_string())?;
written.push(path.display().to_string());
}
Ok(written)
}
fn vocab() -> Written {
let dir = parity::golden("vocab");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;