Skip to content

Carry UEB capitals and typeform passages over consecutive List Paragraph paragraphs - #186

Merged
krperry merged 2 commits into
fix/ueb-typeform-rulesfrom
fix/ueb-passage-runs
Oct 20, 2026
Merged

krperry merged 2 commits into
fix/ueb-typeform-rulesfrom
fix/ueb-passage-runs

Conversation

@krperry

@krperry krperry commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #185 (fix/ueb-typeform-rules), which adds the TextTranslator.isUebLiterary helper this uses. Merge that one first.

Problem

ASM's statements put fully capitalised notices, address blocks and bold notices in consecutive Word "List Paragraph" paragraphs. BrailleBlaster translated each paragraph on its own, so a passage was closed and reopened at every paragraph break.

Fix

The docx import marks List Paragraph items with utd:passageRun. Word's "List" and "List 2" items import as the same list items, but they aren't marked. When a passage at the end of one marked block carries on at the start of the next, GenericBlockAction translates the run in one liblouis call (the paragraphs joined by a newline), and each block keeps the cells that come from its own text.

  • Capitals (matches Duxbury): one capitals passage indicator before the first word and one terminator after the last uppercase letter.
    before: ,,CVRXCU/OM]#JJDIHAD ,,"N#A     after: ,,,cvrxcu/om]#jjdihad "n#a
            ,,CVRXCU/OM]#JJDIHAD ,,"N#B            cvrxcu/om]#jjdihad "n#b,'
    
  • Typeforms (Braille Formats 2016 §5.6, Rules of UEB 9.9.1): each paragraph starts with the typeform passage indicator, and the typeform is terminated only where it changes. This covers italic, bold, underline, script and the transcriber-defined typeforms. Two words across a paragraph break keep their word indicators.
    before: ^7,yr pay;t is late & y may [e a fee4^'    after: ^7,yr pay;t is late & y may [e a fee4
            ^7,call u td to set up a plan4^'                  ^7,call u td to set up a plan4^'
    

A passage that ends inside its paragraph, Normal and "List" paragraphs, headings, and non-UEB tables (Spanish, EBAE) are translated as before.

Known differences and limits

  • Different from Duxbury on purpose (9.9.1): BR-78_lws page 3, and BR-10_lws / BR-39_lws page 5, where a bold paragraph runs into bold text in the next one. Duxbury closes the passage there.
  • UEB 8.5.5 versus Duxbury: 8.5.5 says each paragraph of a capitals passage should also start with ,,,. This PR matches Duxbury (one ,,,) instead.
  • Scope: only Word List Paragraph paragraphs. NIMAS, EPUB and other formats, and Word Normal paragraphs, will follow in a later PR.
  • Editing: if you edit one paragraph of a run in the editor, only that block is retranslated. The paragraphs next to it update when they're retranslated.

Tests

DocxPassageRunTest (15 tests): the job examples, bold/italic/bold+underline runs, bold that ends partway through the next paragraph, two bold words, a run across a braille page break, and Normal and "List" paragraphs that are unchanged.

ASM's statements put fully capitalised notices and address blocks in
consecutive Word "List Paragraph" paragraphs. Duxbury treats such a run as
one UEB capitals passage: one capitals passage indicator before its first
word and one capitals terminator after its last uppercase letter.
BrailleBlaster translated each paragraph on its own, closing and reopening
the passage, or using capital word indicators when a paragraph had fewer
than three words:

  before: ,,CVRXCU/OM]#JJDIHAD ,,"N#A    after: ,,,cvrxcu/om]#jjdihad "n#a
          ,,CVRXCU/OM]#JJDIHAD ,,"N#B           cvrxcu/om]#jjdihad "n#b,'

The docx import now marks List Paragraph items with utd:capitalsRun
("List" and "List 2".. items, which import as the same list items, are not
marked). When a marked block's fully capitalised words carry on into the
marked block next to it, GenericBlockAction translates the run in one
liblouis call (paragraphs joined by a newline, plain typeform) and each
block keeps the cells that come from its own text. A passage that ends
inside its paragraph, Normal and "List" paragraphs, headings, and non-UEB
tables are translated as before.
Braille Formats 2016 5.6 (font emphasis for one or more paragraphs) and
Rules of UEB 9.9.1: when a typeform passage extends over more than one
text element, each element is preceded by the typeform passage indicator
and the typeform is terminated only where it changes. BrailleBlaster
closed the passage at the end of every paragraph:

  before: ^7,yr pay;t is late & y may [e a fee4^'
          ^7,call u td to set up a plan4^'
  after:  ^7,yr pay;t is late & y may [e a fee4
          ^7,call u td to set up a plan4^'

The List Paragraph run that carries a capitals passage now also carries
font typeforms (italic, bold, underline, script, transcriber-defined)
when the end of one paragraph and the start of the next share them and
together make three or more words. The run is translated in one call
with the joint in those typeforms, and each later paragraph gets the
passage indicator liblouis uses for them. Two words across a joint keep
their word indicators. The marker is renamed utd:passageRun.

This changes BR-78_lws page 3 and BR-10_lws/BR-39_lws page 5, where a
bold paragraph runs into bold text in the next one; Duxbury closes the
passage there. Normal and "List" paragraphs are unchanged.
@krperry
krperry merged commit 9964871 into fix/ueb-typeform-rules Oct 20, 2026
krperry added a commit that referenced this pull request Oct 20, 2026
Carry UEB capitals and typeform passages over consecutive List Paragraph paragraphs (land #186)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant