bibclean: decode HTML character references in the title and author

html_entity (weight 2): "Master & Apprentice", left by a web page
the record was copied from. The named references a catalogue meets and
every numeric one are decoded first, before any rule reads the text; a
bare ampersand is left alone. Nine titles in a 6,022-record catalogue.
This commit is contained in:
funkpower committed 2026-11-24 08:56:42 -05:00
1 parent a5f6872175
commit f0cc4a854a
4 files changed
+78

No files matched your search

+5
View File
@@ -160,6 +160,7 @@ const WEIGHTS: &[(&str, u32)] = &[
("author_role_suffix", 2),
("edited_volume", 1),
("filename_title", 3),
("html_entity", 2),
("junk_title", 3),
("lowercase_title", 2),
("missing_apostrophe", 2),
@@ -230,6 +231,10 @@ pub fn problems(title: Option<&str>, author: Option<&str>, isbn: Option<&str>) -
{
reasons.push("numeric_author");
}
if crate::fix::decode_entities(title).is_some() || crate::fix::decode_entities(author).is_some()
{
reasons.push("html_entity");
}
if textkit::mojibake::is_mojibake(title) {
reasons.push("mojibake_title");
}