GeezerVison is showing github.com — fix(server): separate EPUB block quotes from adjacent text (#43156) · patroza/t3code@522b067
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/provider/documentTextWorker.ts +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -338,6 +338,10 @@ function* paragraphs(node: XmlNode): Generator<TextPart, void> { |
338 | 338 | if (level) yield `${"#".repeat(Math.min(6, level))} `; |
339 | 339 | yield* text(child); |
340 | 340 | yield "\n"; |
| 341 | + } else if (child.name === "blockquote" && child.hasText) { |
| 342 | + yield LINE_START; |
| 343 | + yield* paragraphs(child); |
| 344 | + yield LINE_START; |
341 | 345 | } else { |
342 | 346 | if (["ol", "ul", "dl"].includes(child.name)) { |
343 | 347 | if (!child.hasText) continue; |
|
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/provider/userInputAttachments.test.ts +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -672,7 +672,7 @@ describe("question answer paths", () => { |
672 | 672 | "book.opf": |
673 | 673 | '<package><manifest><item id="chapter" href="chapter.xhtml" media-type="application/xhtml+xml"/></manifest><spine><itemref idref="chapter"/></spine></package>', |
674 | 674 | "chapter.xhtml": |
675 | | - '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Guide</title></head><body><ol><li>Before boarding<div><ul><li>Check passports</li></ul></div></li></ol>Intro<ul><li>Read the checklist</li></ul><dl><dt>Visa</dt><dd>Requirements<ul><li>Photo</li></ul></dd></dl><div>Carry<dl><dt>Passport</dt><dd>Required</dd></dl></div><div>Leave <ul></ul>room</div><div>Keep <ul><li hidden="">Draft</li></ul>walking</div></body></html>', |
| 675 | + '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Guide</title></head><body><ol><li>Before boarding<div><ul><li>Check passports</li></ul></div></li></ol>Intro<ul><li>Read the checklist</li></ul><dl><dt>Visa</dt><dd>Requirements<ul><li>Photo</li></ul></dd></dl><div>Carry<dl><dt>Passport</dt><dd>Required</dd></dl></div><div>Leave <ul></ul>room</div><div>Keep <ul><li hidden="">Draft</li></ul>walking</div><div>Safety note<blockquote>Check the gate.</blockquote>Continue to the terminal.</div><div>Keep some <blockquote></blockquote>space.</div></body></html>', |
676 | 676 | }, |
677 | 677 | expected: [ |
678 | 678 | "Before boarding\nCheck passports", |
@@ -681,6 +681,8 @@ describe("question answer paths", () => { |
681 | 681 | "Carry\nPassport\nRequired", |
682 | 682 | "Leave room", |
683 | 683 | "Keep walking", |
| 684 | + "Safety note\nCheck the gate.\nContinue to the terminal.", |
| 685 | + "Keep some space.", |
684 | 686 | ], |
685 | 687 | }, |
686 | 688 | { |
|