mirror of
https://git.pumpin.online/funkpower/catena.git
synced 2026-11-24 19:32:56 +00:00
bibclean: a name in capitals is allcaps_author, not author_list_commas
as_byline fell back to author_list_commas whenever no other fault was found, so "STEVEN BOX" was reported as a list joined with commas. A heading with letters and no lowercase is now allcaps_author (weight 2); the repair is the same byline.
This commit is contained in:
3 files changed
+22
-1
No files matched your search
@@ -169,6 +169,13 @@ pub fn as_byline(author: &str) -> Option<(String, Vec<&'static str>)> {
|
||||
{
|
||||
return None;
|
||||
}
|
||||
// Shouting, put in the case a title page prints names in: "STEVEN BOX".
|
||||
if faults.is_empty()
|
||||
&& original.chars().any(char::is_alphabetic)
|
||||
&& !original.chars().any(char::is_lowercase)
|
||||
{
|
||||
faults.push("allcaps_author");
|
||||
}
|
||||
// Only the separator changed: "Patrick Laude, Barry McDonald".
|
||||
if faults.is_empty() {
|
||||
faults.push("author_list_commas");
|
||||
@@ -302,6 +309,18 @@ mod tests {
|
||||
as_byline(author).map(|(name, _)| name)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_name_in_capitals_is_named_as_shouting() {
|
||||
assert_eq!(
|
||||
as_byline("STEVEN BOX"),
|
||||
Some(("Steven Box".to_string(), vec!["allcaps_author"]))
|
||||
);
|
||||
assert_eq!(
|
||||
as_byline("Patrick Laude, Barry McDonald").map(|(_, faults)| faults),
|
||||
Some(vec!["author_list_commas"])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_heading_is_turned_round() {
|
||||
for (heading, want) in [
|
||||
|
||||
Reference in new issue
Block a user