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
@@ -198,6 +198,7 @@ bibclean books.ndjson | jq -c 'select(.slug_proposal.tier | IN("placeholder-auth
|
||||
| `publisher_as_author` | 3 | An imprint in the author field |
|
||||
| `title_in_author` | 3 | The title is a placeholder and the real title is in the author field |
|
||||
| `allcaps_title` | 2 | Shouting |
|
||||
| `allcaps_author` | 2 | The same, in the author field: "STEVEN BOX" |
|
||||
| `lowercase_title` | 2 | A filename stub: "heidegger areopagite" |
|
||||
| `missing_apostrophe` | 2 | "Lossky s Argument" |
|
||||
| `possible_swap` | 2 | Title and author look to be the wrong way round |
|
||||
@@ -224,7 +225,7 @@ an author field is wrong while "Oxford, Michael" is a person.
|
||||
| `junk_title` | "Microsoft Word - " and the like come off the front |
|
||||
| `filename_title` | A document extension comes off the end |
|
||||
| `placeholder_suffix` | The "- Unknown" comes off the end |
|
||||
| `author_role_suffix`, `author_list_commas` | The heading put as a byline: dates, roles and fuller forms off, each name given names first, the names joined with "&". A field that is only "Surname, Given" is left alone, since some catalogues keep that order on purpose; `bibclean::heading::as_byline` turns it round for a caller that wants bylines |
|
||||
| `author_role_suffix`, `author_list_commas`, `allcaps_author` | The heading put as a byline: dates, roles and fuller forms off, each name given names first, the names joined with "&". A field that is only "Surname, Given" is left alone, since some catalogues keep that order on purpose; `bibclean::heading::as_byline` turns it round for a caller that wants bylines |
|
||||
| `title_punctuation` | Set as a title page sets it; a full stop after an initial or abbreviation stays |
|
||||
| `numbered_title`, `release_tags` | The number comes off the front, the tags off the end. A series named in front as well ("Known Space-038-…") is `seriesof`'s, which keeps the series |
|
||||
| `name_in_title` | The names come off the front, and the publisher, year and series off the end; the names are proposed as the author. Made only when the record has no real author, or already has the same one |
|
||||
|
||||
@@ -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 [
|
||||
|
||||
@@ -153,6 +153,7 @@ const PERSON_SUFFIXES: &[&str] = &["ed", "eds", "ii", "iii", "iv", "jr", "md", "
|
||||
/// What each fault is worth when the worst records are wanted first.
|
||||
const WEIGHTS: &[(&str, u32)] = &[
|
||||
("account_author", 3),
|
||||
("allcaps_author", 2),
|
||||
("allcaps_title", 2),
|
||||
("author_is_title", 4),
|
||||
("author_last_first", 1),
|
||||
|
||||
Reference in new issue
Block a user