Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,18 @@ Where a spelling is ambiguous, the Bible's shape decides — a book must have th
cited — never a per-module rule in code. Text is never rewritten to make a citation
easier to recognise.

Text is SWORD's `stripped` projection, except for ThML modules, whose source is projected
by `src/study_builder/content.py` because SWORD's ThML plain filter discards every line
break. The projection keeps SWORD's conventions; a change to it changes the words of every
ThML module and needs the smoke builds. Every text is normalised the same way. Module bytes
UTF-8 cannot read are decoded as Windows-1252, never replaced.
ThML, TEI, and OSIS text is projected from the verified source markup through
`src/study_builder/content.py`. SWORD's stripped projections can discard structural
breaks and XML character references. Keep the source format's paragraph, line, sense,
note, and reference semantics, and decode character references once while reading
markup. Already-plain text must not be HTML-unescaped again. Other formats keep
SWORD's stripped projection. The extractor's `rendered_default` value (internally
named `html`) is not guaranteed to be HTML; it can still contain source markup.
Never use that name to infer its format. These rules apply to dictionaries and
commentaries alike; shared projection changes need both resources' smoke builds.
Preserve source wording and scripts without per-entry replacements or language
filters. Every text is normalised the same way. Module bytes UTF-8 cannot read are
decoded as Windows-1252, never replaced. Public schemas and paths stay unchanged.

Dictionary Strong's keys remain compatible with Bible API v3 (`G3056`, `H0430`).
Repeated dictionary keys retain the unsuffixed direct path for their first
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,25 @@ clients that would otherwise read every word individually.

## Plain text

Every document is plain text, and the text is laid out the way the module laid it out.
SWORD's own plain-text reading of a ThML module collapses every line and paragraph
break, so Torrey's lists and Smith's paragraphs would arrive as one unbroken line; for
ThML modules the builder reads the source markup itself, keeping SWORD's conventions
(entities, `<G3056>` Strong's markers, `[bracketed]` notes) and keeping the breaks. The
other markup families keep their breaks in SWORD's reading already. Whatever the family,
the published text has one space between words, no leading or trailing space on a line,
and at most one blank line between blocks.
Every document is plain text. For ThML, TEI, and OSIS modules, the builder projects the
verified source markup into readable text. SWORD's stripped projections can discard
line breaks and character references: a TEI `<lb/>` can disappear between words, and
a Greek letter written as `&#x03B1;` can be lost. The source-aware projections preserve
paragraphs, line breaks, senses, notes, reference labels, and Unicode characters for
both dictionaries and commentaries. Other source formats retain SWORD's stripped text.

Character references are decoded once, when markup is read. Text that is already plain
is only whitespace-normalised, so literal ampersands and entity-like examples are not
interpreted a second time. The extractor's `rendered_default` field is not necessarily
HTML; the builder does not select a projection based on that field's name.

The conversion preserves source wording, including multilingual text; it does not
translate, substitute dictionary entries, or remove characters by language. These
rendering corrections keep the existing v1 schemas, paths, identifiers, reference
shapes, and complete-download structure. The public `text` remains a string, with one
space between words, no leading or trailing space on a line, and at most one blank
line between blocks. Standalone documents and the corresponding entries embedded in
complete downloads contain identical text.

Bytes the module wrote in Windows-1252 — the `’` of "David’s", the non-breaking space of
"1 Chronicles" — are read as such rather than replaced with `�`.
Expand Down
4 changes: 3 additions & 1 deletion src/study_builder/commentaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ def _entry(self, source: dict[str, Any]) -> dict[str, Any] | None:
related = self.references.extract(
content["text"],
markup=extract_markup_references(
str(source.get("raw", "")), str(source.get("html", ""))
str(source.get("raw", "")),
str(source.get("html", "")),
source_type=self.source_type,
),
book=book.number,
chapter=chapter if chapter > 0 else None,
Expand Down
Loading