bibclean: slugs, and whether the one a record has still names it

This commit is contained in:
funkpower
2026-09-19 14:23:36 -04:00
parent 7fa610c578
commit 14e1fcf3ef
16 changed files with 1342 additions and 34 deletions
+14 -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; 11] = [
let jobs: [Job; 12] = [
("tokens", tokens),
("unescape", unescape),
("chunkmd", chunkmd),
@@ -31,6 +31,7 @@ fn main() -> ExitCode {
("cuepack", cuepack),
("booksniff", booksniff),
("bibclean", bibclean),
("slug", slug),
];
for (name, job) in jobs {
@@ -74,6 +75,18 @@ fn unescape() -> Written {
Ok(vec![path.display().to_string()])
}
fn slug() -> Written {
let dir = parity::golden("slug");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
let cases = parity::dir().join("cases/slug/records.ndjson");
let cases = std::fs::read_to_string(&cases).map_err(|e| e.to_string())?;
let judgements = parity::run_oracle("slug.py", &cases)?;
let path = dir.join("records.ndjson");
std::fs::write(&path, judgements).map_err(|e| e.to_string())?;
Ok(vec![path.display().to_string()])
}
fn bibclean() -> Written {
let dir = parity::golden("bibclean");
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;