citefind: where italics sit decides whether they are the title or the journal

Put a real model behind the entries this could not read and looked at what it
gave back. Almost none of it was knowledge — it was punctuation already on the
page that the parser was walking past:

    Goodwin, F.K. and Jamison, K.R. (1990). *Manicdepressive illness* Oxford
    University Press, New York.

The title is in asterisks. It was being read as the journal, because the rule
said italics after an author-date opening are the journal — true of `Peirce
(1878). Plain title. *Popular Science Monthly*`, and false here. What decides
it is where the italics sit: at the head of the tail they are the work, after
the title they are what it appeared in.

Five more the model was covering for, all of them on the page:

  * `de la Torre, Carlos` opens on a particle and is a name.
  * `Tinbergen, n. 1953` has an initial the scan read in lower case.
  * `Theories of Nationalism: A Critical Introduction, Basingstoke: Palgrave`
    has two colons and the imprint is the last one, not the first.
  * `36Armaud Puig i Tarrech` is a note number run into the name.
  * `S. Marc Cohen is Professor of Philosophy at...` opens exactly as a
    Chicago note does and is a contributor's biography, not a reference.

A title may quote something — `What's the Meaning of "This"?` — so only an
unbalanced quotation mark means the cut landed inside one. A question mark
ends a sentence, which is how that title was being lost. A trailing backslash
is a line break conversion left behind.
This commit is contained in:
funkpower committed 2026-09-20 14:02:13 -04:00
1 parent c92852378f
commit 5dbe091138
2 files changed
+119 -29

No files matched your search

+13
View File
@@ -87,6 +87,11 @@ static FILE_ANCHOR: LazyLock<Regex> = LazyLock::new(|| {
static LOCAL_SIGNAL: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(?s)\b(?:1[4-9]|20)\d{2}\b.*?\d").expect("a valid pattern"));
/// A note number run straight into the text with no space: `36Armaud Puig`.
/// Conversion does this when the marker was a superscript.
static GLUED_NUMBER: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r#"^(\d{1,3})(?:\p{Lu}|\*|“|")"#).expect("a valid pattern"));
/// A bullet or a blockquote marker, which conversion puts in front of a note
/// often enough to matter. A leading `*` is left alone: it opens an italic
/// title as often as it opens a list.
@@ -271,6 +276,14 @@ fn strip_marker(raw: &str) -> Entry {
};
}
if let Some(found) = GLUED_NUMBER.captures(&bare) {
let marker = found[1].to_string();
return Entry {
text: text[from[marker.len()]..].to_string(),
marker: Some(marker),
};
}
if let Some((marker, consumed)) = superscript(&bare) {
return Entry {
text: text[from[consumed]..].trim_start().to_string(),