GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): EPUB attachment text no longer includes hidden passages … · patroza/t3code@80cac28

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/provider
    • documentTextWorker.ts
    • userInputAttachments.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/provider/documentTextWorker.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/documentTextWorker.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,15 @@ function xml(source: string, extension: string): XmlNode {
110110
stack.at(-1)!.children.push(node);
111111
stack.push(node);
112112
});
113-
parser.on("closetag", () => {
113+
parser.on("closetag", (tag) => {
114114
const node = stack.pop()!;
115115
const parent = stack.at(-1)!;
116116
if (odf && (node.name === "p" || node.name === "h")) collapseOdfWhitespace(node);
117117
if (
118+
(extension === ".epub" &&
119+
(stack[1] ?? node).name === "html" &&
120+
Object.hasOwn(tag.attributes, "hidden") &&
121+
!/^until-found$/i.test(String(tag.attributes.hidden))) ||
118122
(extension === ".docx" && node.name === "del") ||
119123
(extension === ".docx" &&
120124
node.name === "r" &&
Collapse file

‎apps/server/src/provider/userInputAttachments.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/userInputAttachments.test.ts
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,11 +1493,12 @@ describe("question answer paths", () => {
14931493
"META-INF/container.xml":
14941494
'<container><rootfile full-path="OEBPS/book.opf"/></container>',
14951495
"OEBPS/book.opf":
1496-
'<package><manifest><item id="a" href="a.xhtml"/><item id="b" href="b.xhtml"/></manifest><spine><itemref idref="b"/><itemref idref="a"/></spine></package>',
1496+
'<package><manifest><item id="a" href="a.xhtml"/><item id="b" href="b.xhtml"/><item id="c" href="c.xhtml"/></manifest><spine><itemref idref="b"/><itemref idref="a" hidden=""/><itemref idref="c"/></spine></package>',
14971497
"OEBPS/a.xhtml":
14981498
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><body><p>Last chapter</p><p>Price <s>10</s> 8 <del>old</del></p></body></html>',
14991499
"OEBPS/b.xhtml":
1500-
'<!DOCTYPE html><html><head><title>My Novel</title><meta name="author" content="Hidden Author"/></head><body><h1>First chapter</h1><p>Larkspur</p><div>Direct div<section>Direct section<li>Direct item <em>emphasis</em> trailing</li></section></div><div>Account: A<br/>Balance: 731<line-break/>Currency: USD</div><table><thead><tr><th>Heading</th><th>Total</th></tr></thead><tbody><tr><td>Important value</td><td>731</td></tr><tr><td>Before<table><tr><td>Inner</td></tr></table>After</td><td>Neighbor</td></tr></tbody></table><dl><dt>Port</dt><dd>443</dd><dt>Timeout</dt><dd>30 seconds</dd></dl></body></html>',
1500+
'<!DOCTYPE html><html><head><title>My Novel</title><meta name="author" content="Hidden Author"/></head><body><h1>First chapter</h1><p>Larkspur</p><div>Direct div<section>Direct section<li>Direct item <em>emphasis</em> trailing</li></section></div><div>Account: A<br/>Balance: 731<line-break/>Currency: USD</div><table><thead><tr><th>Heading</th><th>Total</th></tr></thead><tbody><tr><td>Important value</td><td>731</td></tr><tr><td>Before<table><tr><td>Inner</td></tr></table>After</td><td>Neighbor</td></tr></tbody></table><dl><dt>Port</dt><dd>443</dd><dt>Timeout</dt><dd>30 seconds</dd></dl><p hidden="">Draft note</p><div hidden="hidden">Hidden block<p>Hidden nested</p></div><p hidden="UNTIL-FOUND">Findable note</p><p aria-hidden="true">Decorative note</p><p x:hidden="true">Prefixed note</p></body></html>',
1501+
"OEBPS/c.xhtml": '<html hidden=""><body><p>Root hidden</p></body></html>',
15011502
},
15021503
expected: [
15031504
"## Chapter 1",
@@ -1511,11 +1512,20 @@ describe("question answer paths", () => {
15111512
"Important value\t731",
15121513
"Before Inner After\tNeighbor",
15131514
"Port\n443\nTimeout\n30 seconds",
1515+
"Findable note\nDecorative note\nPrefixed note",
15141516
"## Chapter 2",
15151517
"Last chapter",
15161518
"Price 10 8 old",
1519+
"## Chapter 3",
1520+
],
1521+
absent: [
1522+
"My Novel",
1523+
"Hidden Author",
1524+
"Draft note",
1525+
"Hidden block",
1526+
"Hidden nested",
1527+
"Root hidden",
15171528
],
1518-
absent: ["My Novel", "Hidden Author"],
15191529
},
15201530
];
15211531
for (const [caseIndex, item] of cases.entries()) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.