Fix edition font UUID rebinding and Protocols translation layout

This commit is contained in:
Kai Tan
2026-10-10 00:42:37 +08:00
parent 26da365cb2
commit 3e2093dba8
12 changed files with 522 additions and 4 deletions
+12
View File
@@ -315,3 +315,15 @@ def test_nested_toc_anchor_binds_heading_and_normalizes_visible_ordinal():
# A nested anchor in ordinary prose must still not become a title.
assert not _headings(parse_html('<p><a id="prose">A sentence.</a></p>'),
'chapter.xhtml#prose', 'Chapter 1. Obsession')[0]
def test_graphical_title_binds_using_alt_without_mutating_image():
from src.common.html import parse_html
from src.preprocessing.navigation import _headings
soup = parse_html('<section id="ch"><h1 id="heading">CHAPTER 1'
'<span><img src="word.jpeg" alt="Protocols."/></span>'
'<span><i>for</i> SLEEP</span></h1></section>')
before = str(soup)
headings, reason = _headings(soup, 'ch.xhtml#ch', 'Chapter 1: Protocols for Sleep')
assert reason is None and [h['id'] for h in headings] == ['heading']
assert str(soup) == before