mirror of
https://git.pumpin.online/funkpower/catena.git
synced 2026-11-24 19:32:56 +00:00
citefind: a note the translator signed is not a reference
Both volumes of *The Decline of the West* went from zero citations to 415
once the arrow marker was recognised — and 167 of those were the editor's and
the translator's own glosses:
Latin: "nature of the thing." — Ed.
Reference to the wars between Athens and Sparta. Their dates are
431-404 BC and 31 BC. — Ed.
An em dash and a role at the very end is how a translator signs a note of
their own. It cites nothing, and it is a convention every academic
translation uses.
391 of the 415 also carried a stray `<!-- -->`: pandoc's list separator, left
in the middle of the reference text. HTML comments are conversion furniture
and are cut with the marker.
And `See R. Hirzel, Die Person (1914), p. 7.` read as an author-date entry
whose authors were "R. Hirzel, Die Person" and whose title was nothing — the
head is all capitalised words and the year is bracketed, which is exactly
what an author-date opening looks like. Where that reading yields no title
and reading it as a note yields one, the note wins. Having a title is how you
can tell which was meant.
This commit is contained in:
2 files changed
+64
No files matched your search
@@ -112,6 +112,11 @@ static ARROW_MARKER: LazyLock<Regex> = LazyLock::new(|| {
|
||||
.expect("a valid pattern")
|
||||
});
|
||||
|
||||
/// An HTML comment. Conversion leaves `<!-- -->` between list items and
|
||||
/// `<!-- Page 41 -->` where a page turned; neither is part of a reference.
|
||||
static COMMENT: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r"<!--.*?-->").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.
|
||||
@@ -276,6 +281,7 @@ fn unnumbered(text: &str) -> Vec<Entry> {
|
||||
/// further along survives.
|
||||
fn strip_marker(raw: &str) -> Entry {
|
||||
let text = cut_footer(&tidy(raw));
|
||||
let text = tidy(&COMMENT.replace_all(&text, " "));
|
||||
let text = BULLET.replace(&text, "").to_string();
|
||||
let (bare, from) = visible(&text, 160);
|
||||
|
||||
@@ -517,6 +523,24 @@ Another Anonymous Work. Cambridge, 2001.";
|
||||
assert_eq!(entry.text, "Holquist, Making War, pp. 211-12.");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_back_reference_marker_an_epub_conversion_leaves() {
|
||||
let plain = strip_marker("\\[←788 \\]\u{a0} Krumbacher, Byz. Lit.-Gesch., p. 969.");
|
||||
assert_eq!(plain.marker.as_deref(), Some("788"));
|
||||
assert_eq!(plain.text, "Krumbacher, Byz. Lit.-Gesch., p. 969.");
|
||||
|
||||
let linked =
|
||||
strip_marker("\\[[←193](index_split_011.xhtml#citation-193) \\]\u{a0} Œd. Rex., 642.");
|
||||
assert_eq!(linked.marker.as_deref(), Some("193"));
|
||||
assert_eq!(linked.text, "Œd. Rex., 642.");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_comment_conversion_left_behind_is_not_part_of_a_reference() {
|
||||
let entry = strip_marker("1. Smith, *A Title* (Oxford, 1998). <!-- -->");
|
||||
assert_eq!(entry.text, "Smith, *A Title* (Oxford, 1998).");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_entry_with_no_marker_keeps_all_of_itself() {
|
||||
let entry = strip_marker("Smith, John. The Title. Oxford, 1998.");
|
||||
|
||||
Reference in new issue
Block a user