@unisim/doc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/dist/convert.d.ts +54 -0
- package/dist/convert.d.ts.map +1 -0
- package/dist/convert.js +216 -0
- package/dist/convert.js.map +1 -0
- package/dist/image.d.ts +17 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +66 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/merge.d.ts +14 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +51 -0
- package/dist/merge.js.map +1 -0
- package/dist/metrics.d.ts +19 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +151 -0
- package/dist/metrics.js.map +1 -0
- package/dist/model.d.ts +114 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +121 -0
- package/dist/model.js.map +1 -0
- package/dist/pdfcore.d.ts +118 -0
- package/dist/pdfcore.d.ts.map +1 -0
- package/dist/pdfcore.js +398 -0
- package/dist/pdfcore.js.map +1 -0
- package/dist/read/csv.d.ts +17 -0
- package/dist/read/csv.d.ts.map +1 -0
- package/dist/read/csv.js +167 -0
- package/dist/read/csv.js.map +1 -0
- package/dist/read/doc.d.ts +3 -0
- package/dist/read/doc.d.ts.map +1 -0
- package/dist/read/doc.js +360 -0
- package/dist/read/doc.js.map +1 -0
- package/dist/read/docx.d.ts +3 -0
- package/dist/read/docx.d.ts.map +1 -0
- package/dist/read/docx.js +455 -0
- package/dist/read/docx.js.map +1 -0
- package/dist/read/html.d.ts +4 -0
- package/dist/read/html.d.ts.map +1 -0
- package/dist/read/html.js +236 -0
- package/dist/read/html.js.map +1 -0
- package/dist/read/json.d.ts +9 -0
- package/dist/read/json.d.ts.map +1 -0
- package/dist/read/json.js +105 -0
- package/dist/read/json.js.map +1 -0
- package/dist/read/markdown.d.ts +4 -0
- package/dist/read/markdown.d.ts.map +1 -0
- package/dist/read/markdown.js +247 -0
- package/dist/read/markdown.js.map +1 -0
- package/dist/read/odt.d.ts +3 -0
- package/dist/read/odt.d.ts.map +1 -0
- package/dist/read/odt.js +359 -0
- package/dist/read/odt.js.map +1 -0
- package/dist/read/rtf.d.ts +3 -0
- package/dist/read/rtf.d.ts.map +1 -0
- package/dist/read/rtf.js +341 -0
- package/dist/read/rtf.js.map +1 -0
- package/dist/read/text.d.ts +4 -0
- package/dist/read/text.d.ts.map +1 -0
- package/dist/read/text.js +62 -0
- package/dist/read/text.js.map +1 -0
- package/dist/unzip.d.ts +23 -0
- package/dist/unzip.d.ts.map +1 -0
- package/dist/unzip.js +152 -0
- package/dist/unzip.js.map +1 -0
- package/dist/write/data.d.ts +16 -0
- package/dist/write/data.d.ts.map +1 -0
- package/dist/write/data.js +89 -0
- package/dist/write/data.js.map +1 -0
- package/dist/write/pdf.d.ts +10 -0
- package/dist/write/pdf.d.ts.map +1 -0
- package/dist/write/pdf.js +696 -0
- package/dist/write/pdf.js.map +1 -0
- package/dist/write/pdfSettings.d.ts +13 -0
- package/dist/write/pdfSettings.d.ts.map +1 -0
- package/dist/write/pdfSettings.js +26 -0
- package/dist/write/pdfSettings.js.map +1 -0
- package/dist/write/text.d.ts +5 -0
- package/dist/write/text.d.ts.map +1 -0
- package/dist/write/text.js +341 -0
- package/dist/write/text.js.map +1 -0
- package/dist/xml.d.ts +22 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +83 -0
- package/dist/xml.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odt.d.ts","sourceRoot":"","sources":["../../src/read/odt.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEsB,KAAK,OAAO,EACxC,MAAM,aAAa,CAAA;AAmBpB,wBAAsB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAyB1D"}
|
package/dist/read/odt.js
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// ODT (OpenDocument Text) → RichDoc.
|
|
3
|
+
//
|
|
4
|
+
// LibreOffice's and OpenOffice's native format, and what Google Docs gives you
|
|
5
|
+
// if you ask for anything other than .docx. Structurally it is the same bargain
|
|
6
|
+
// as DOCX — a ZIP of XML — which is why it cost one file rather than a rewrite:
|
|
7
|
+
// the reader below is the same shape as `docx.ts`, over a vocabulary that is
|
|
8
|
+
// mostly nicer.
|
|
9
|
+
//
|
|
10
|
+
// TWO PLACES IT IS GENUINELY EASIER THAN DOCX
|
|
11
|
+
// -------------------------------------------
|
|
12
|
+
// * `<text:h text:outline-level="2">` says it is a heading and how deep,
|
|
13
|
+
// in the element itself. No style table, no three-way heuristic.
|
|
14
|
+
// * `<text:list>` is a real element that CONTAINS its items, rather than
|
|
15
|
+
// DOCX's run of sibling paragraphs that happen to share a numbering id.
|
|
16
|
+
//
|
|
17
|
+
// And one where it is worse: whether a list is bulleted or numbered lives in
|
|
18
|
+
// the list's STYLE, in a different part of the file, so that lookup comes back.
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
import { addNotice, mergeRuns, tidy, } from '../model.js';
|
|
21
|
+
import { ZipArchive } from '../unzip.js';
|
|
22
|
+
import { attr, child, children, descendant, descendants, parseXml } from '../xml.js';
|
|
23
|
+
const OFFICE = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0';
|
|
24
|
+
const TEXT = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0';
|
|
25
|
+
const TABLE = 'urn:oasis:names:tc:opendocument:xmlns:table:1.0';
|
|
26
|
+
const DRAW = 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0';
|
|
27
|
+
const STYLE = 'urn:oasis:names:tc:opendocument:xmlns:style:1.0';
|
|
28
|
+
const FO = 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0';
|
|
29
|
+
const XLINK = 'http://www.w3.org/1999/xlink';
|
|
30
|
+
const DC = 'http://purl.org/dc/elements/1.1/';
|
|
31
|
+
const META = 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0';
|
|
32
|
+
const IMAGE_MIME = {
|
|
33
|
+
png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif',
|
|
34
|
+
bmp: 'image/bmp', webp: 'image/webp', svg: 'image/svg+xml',
|
|
35
|
+
};
|
|
36
|
+
export async function readOdt(file) {
|
|
37
|
+
const zip = await ZipArchive.open(file);
|
|
38
|
+
const contentXml = await zip.textOf('content.xml');
|
|
39
|
+
if (!contentXml)
|
|
40
|
+
throw new Error('This isn’t an OpenDocument file inside — `content.xml` is missing.');
|
|
41
|
+
const doc = { blocks: [], notices: [] };
|
|
42
|
+
const content = parseXml(contentXml, 'content');
|
|
43
|
+
const styles = readTextStyles(content, await zip.textOf('styles.xml'));
|
|
44
|
+
await readMeta(zip, doc);
|
|
45
|
+
const body = descendant(content, OFFICE, 'text');
|
|
46
|
+
if (!body)
|
|
47
|
+
throw new Error('This OpenDocument file has no text body.');
|
|
48
|
+
const ctx = { zip, styles, breakBefore: pageBreakStyles.get(content) ?? new Set(), doc };
|
|
49
|
+
await readBlocks(body, ctx, doc.blocks);
|
|
50
|
+
if (descendant(content, TEXT, 'note')) {
|
|
51
|
+
addNotice(doc, 'Footnotes were left out — this repaginates, so their page anchors no longer apply.');
|
|
52
|
+
}
|
|
53
|
+
if (descendant(content, DRAW, 'object')) {
|
|
54
|
+
addNotice(doc, 'A chart or embedded object was left out — those aren’t pictures, and can’t be drawn here.');
|
|
55
|
+
}
|
|
56
|
+
return tidy(doc);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Paragraph style names carrying `fo:break-before="page"`.
|
|
60
|
+
*
|
|
61
|
+
* Kept in a module-level map keyed by the content document for the same reason
|
|
62
|
+
* `spanFormats` is: `readTextStyles` scans both style parts in one pass and can
|
|
63
|
+
* only return one thing.
|
|
64
|
+
*/
|
|
65
|
+
const pageBreakStyles = new WeakMap();
|
|
66
|
+
async function readBlocks(root, ctx, out) {
|
|
67
|
+
for (const node of Array.from(root.childNodes)) {
|
|
68
|
+
if (node.nodeType !== 1)
|
|
69
|
+
continue;
|
|
70
|
+
const el = node;
|
|
71
|
+
if (el.namespaceURI === TEXT) {
|
|
72
|
+
switch (el.localName) {
|
|
73
|
+
case 'h': {
|
|
74
|
+
const raw = Number(attr(el, TEXT, 'outline-level') ?? '1');
|
|
75
|
+
const level = Math.min(4, Math.max(1, Number.isFinite(raw) ? raw : 1));
|
|
76
|
+
out.push({ kind: 'heading', level, runs: mergeRuns(await readRuns(el, ctx)) });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
case 'p': {
|
|
80
|
+
const runs = mergeRuns(await readRuns(el, ctx));
|
|
81
|
+
const images = await readImages(el, ctx);
|
|
82
|
+
const styleName = attr(el, TEXT, 'style-name') ?? '';
|
|
83
|
+
// ⚠️ A HARD page break in ODF is a PARAGRAPH PROPERTY, not an element:
|
|
84
|
+
// `fo:break-before="page"` on the style this paragraph uses. Only the
|
|
85
|
+
// *soft* break — where LibreOffice's own layout happened to land last
|
|
86
|
+
// time — appears in the body, and that one is ignored. Reading only
|
|
87
|
+
// the body therefore loses every deliberate page break in the file.
|
|
88
|
+
if (ctx.breakBefore.has(styleName))
|
|
89
|
+
out.push({ kind: 'pagebreak' });
|
|
90
|
+
if (runs.length) {
|
|
91
|
+
out.push(/quotation|blockquote/i.test(styleName)
|
|
92
|
+
? { kind: 'quote', runs }
|
|
93
|
+
: { kind: 'paragraph', runs });
|
|
94
|
+
}
|
|
95
|
+
else if (!images.length) {
|
|
96
|
+
out.push({ kind: 'paragraph', runs: [{ text: ' ' }] });
|
|
97
|
+
}
|
|
98
|
+
out.push(...images);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
case 'list':
|
|
102
|
+
case 'numbered-paragraph': {
|
|
103
|
+
const items = [];
|
|
104
|
+
await readListItems(el, ctx, items, 0);
|
|
105
|
+
if (items.length) {
|
|
106
|
+
const styleName = attr(el, TEXT, 'style-name') ?? '';
|
|
107
|
+
out.push({ kind: 'list', ordered: ctx.styles.get(styleName) ?? false, items });
|
|
108
|
+
}
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
case 'section':
|
|
112
|
+
case 'list-header':
|
|
113
|
+
await readBlocks(el, ctx, out);
|
|
114
|
+
continue;
|
|
115
|
+
case 'soft-page-break':
|
|
116
|
+
// A RENDERING artefact — where LibreOffice's own layout happened to
|
|
117
|
+
// break the page last time it was opened, not an instruction. Honouring
|
|
118
|
+
// it would scatter page breaks through a document that has none.
|
|
119
|
+
continue;
|
|
120
|
+
default:
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (el.namespaceURI === TABLE && el.localName === 'table') {
|
|
125
|
+
out.push(await readTable(el, ctx));
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (el.namespaceURI === TEXT && el.localName === 'table-of-content')
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** Items, recursing into nested lists so indentation survives. */
|
|
133
|
+
async function readListItems(list, ctx, out, level) {
|
|
134
|
+
for (const item of children(list, TEXT, 'list-item')) {
|
|
135
|
+
for (const node of Array.from(item.childNodes)) {
|
|
136
|
+
if (node.nodeType !== 1)
|
|
137
|
+
continue;
|
|
138
|
+
const el = node;
|
|
139
|
+
if (el.namespaceURI !== TEXT)
|
|
140
|
+
continue;
|
|
141
|
+
if (el.localName === 'p' || el.localName === 'h') {
|
|
142
|
+
out.push({ runs: mergeRuns(await readRuns(el, ctx)), level });
|
|
143
|
+
}
|
|
144
|
+
else if (el.localName === 'list') {
|
|
145
|
+
await readListItems(el, ctx, out, Math.min(4, level + 1));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Inline content.
|
|
152
|
+
*
|
|
153
|
+
* The one thing worth knowing: ODF does not put runs of spaces in the text.
|
|
154
|
+
* `<text:s text:c="4"/>` means four of them, because XML would collapse the
|
|
155
|
+
* literal characters. Miss it and indented code inside a document loses its
|
|
156
|
+
* shape entirely.
|
|
157
|
+
*/
|
|
158
|
+
async function readRuns(parent, ctx, inherited = {}) {
|
|
159
|
+
const out = [];
|
|
160
|
+
for (const node of Array.from(parent.childNodes)) {
|
|
161
|
+
if (node.nodeType === 3) {
|
|
162
|
+
out.push({ ...inherited, text: node.nodeValue ?? '' });
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (node.nodeType !== 1)
|
|
166
|
+
continue;
|
|
167
|
+
const el = node;
|
|
168
|
+
if (el.namespaceURI !== TEXT)
|
|
169
|
+
continue;
|
|
170
|
+
switch (el.localName) {
|
|
171
|
+
case 'span':
|
|
172
|
+
out.push(...(await readRuns(el, ctx, { ...inherited, ...spanFormat(el) })));
|
|
173
|
+
break;
|
|
174
|
+
case 'a': {
|
|
175
|
+
const href = attr(el, XLINK, 'href') ?? undefined;
|
|
176
|
+
// Same rule as DOCX: only a link that leaves the document survives.
|
|
177
|
+
const external = href && !href.startsWith('#') ? href : undefined;
|
|
178
|
+
out.push(...(await readRuns(el, ctx, { ...inherited, link: external })));
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 's': {
|
|
182
|
+
const count = Number(attr(el, TEXT, 'c') ?? '1');
|
|
183
|
+
out.push({ ...inherited, text: ' '.repeat(Number.isFinite(count) ? Math.min(count, 200) : 1) });
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case 'tab':
|
|
187
|
+
out.push({ ...inherited, text: ' ' });
|
|
188
|
+
break;
|
|
189
|
+
case 'line-break':
|
|
190
|
+
out.push({ ...inherited, text: '\n' });
|
|
191
|
+
break;
|
|
192
|
+
case 'note':
|
|
193
|
+
// Skipped deliberately — see the notice raised in `readOdt`.
|
|
194
|
+
break;
|
|
195
|
+
case 'bookmark':
|
|
196
|
+
case 'bookmark-start':
|
|
197
|
+
case 'bookmark-end':
|
|
198
|
+
case 'sequence-decls':
|
|
199
|
+
break;
|
|
200
|
+
default:
|
|
201
|
+
out.push(...(await readRuns(el, ctx, inherited)));
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The formatting a `<text:span>` carries.
|
|
209
|
+
*
|
|
210
|
+
* ODF holds it in an automatic style in the same file, so the span names a
|
|
211
|
+
* style and the style names the weight. `styleFormats` is built once up front
|
|
212
|
+
* because a document of any size names the same handful over and over.
|
|
213
|
+
*/
|
|
214
|
+
const spanFormats = new WeakMap();
|
|
215
|
+
function spanFormat(el) {
|
|
216
|
+
const name = attr(el, TEXT, 'style-name');
|
|
217
|
+
if (!name)
|
|
218
|
+
return {};
|
|
219
|
+
return spanFormats.get(el.ownerDocument)?.get(name) ?? {};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Read both style parts.
|
|
223
|
+
*
|
|
224
|
+
* Two maps in one pass, keyed differently so they can share a return: list
|
|
225
|
+
* style name → is-numbered, and (in the WeakMap above) text style name → run
|
|
226
|
+
* formatting. Automatic styles live in `content.xml`, named ones in
|
|
227
|
+
* `styles.xml`, and a document uses both.
|
|
228
|
+
*/
|
|
229
|
+
function readTextStyles(content, stylesXml) {
|
|
230
|
+
const ordered = new Map();
|
|
231
|
+
const runs = new Map();
|
|
232
|
+
const breaks = new Set();
|
|
233
|
+
const scan = (doc) => {
|
|
234
|
+
for (const style of descendants(doc, TEXT, 'list-style')) {
|
|
235
|
+
const name = attr(style, STYLE, 'name');
|
|
236
|
+
if (!name)
|
|
237
|
+
continue;
|
|
238
|
+
// A numbered list declares `<text:list-level-style-number>`; a bulleted
|
|
239
|
+
// one declares `…-bullet`. Level 1 decides for the whole list.
|
|
240
|
+
ordered.set(name, descendant(style, TEXT, 'list-level-style-number') !== null);
|
|
241
|
+
}
|
|
242
|
+
for (const style of descendants(doc, STYLE, 'style')) {
|
|
243
|
+
const name = attr(style, STYLE, 'name');
|
|
244
|
+
if (!name)
|
|
245
|
+
continue;
|
|
246
|
+
if (attr(style, STYLE, 'family') === 'paragraph') {
|
|
247
|
+
const paragraphProps = child(style, STYLE, 'paragraph-properties');
|
|
248
|
+
// 'page' and 'column' are the two values; only 'page' is a page break.
|
|
249
|
+
if (paragraphProps && attr(paragraphProps, FO, 'break-before') === 'page') {
|
|
250
|
+
breaks.add(name);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (attr(style, STYLE, 'family') !== 'text')
|
|
254
|
+
continue;
|
|
255
|
+
const props = child(style, STYLE, 'text-properties');
|
|
256
|
+
if (!props)
|
|
257
|
+
continue;
|
|
258
|
+
const format = {};
|
|
259
|
+
if ((attr(props, FO, 'font-weight') ?? '') === 'bold')
|
|
260
|
+
format.bold = true;
|
|
261
|
+
if (/italic|oblique/.test(attr(props, FO, 'font-style') ?? ''))
|
|
262
|
+
format.italic = true;
|
|
263
|
+
const underline = attr(props, STYLE, 'text-underline-style') ?? 'none';
|
|
264
|
+
if (underline !== 'none')
|
|
265
|
+
format.underline = true;
|
|
266
|
+
const strike = attr(props, STYLE, 'text-line-through-style') ?? 'none';
|
|
267
|
+
if (strike !== 'none')
|
|
268
|
+
format.strike = true;
|
|
269
|
+
const family = attr(props, STYLE, 'font-name') ?? attr(props, FO, 'font-family') ?? '';
|
|
270
|
+
if (/mono|courier|consolas|menlo/i.test(family))
|
|
271
|
+
format.code = true;
|
|
272
|
+
if (Object.keys(format).length)
|
|
273
|
+
runs.set(name, format);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
scan(content);
|
|
277
|
+
// `styles.xml` holds the NAMED styles a document defines; `content.xml` holds
|
|
278
|
+
// the AUTOMATIC ones LibreOffice generates per paragraph. A file uses both,
|
|
279
|
+
// and a page break almost always lands on an automatic style — so scanning
|
|
280
|
+
// only the named part finds nothing.
|
|
281
|
+
if (stylesXml)
|
|
282
|
+
scan(parseXml(stylesXml, 'styles'));
|
|
283
|
+
// Both parts feed the same maps, keyed off `content`'s document, because that
|
|
284
|
+
// is the one every element the readers touch actually belongs to.
|
|
285
|
+
spanFormats.set(content, runs);
|
|
286
|
+
pageBreakStyles.set(content, breaks);
|
|
287
|
+
return ordered;
|
|
288
|
+
}
|
|
289
|
+
async function readTable(el, ctx) {
|
|
290
|
+
const rows = [];
|
|
291
|
+
// `table:table-header-rows` wraps the header when there is one; its rows are
|
|
292
|
+
// ordinary `table-row`s one level down, so both are collected.
|
|
293
|
+
const rowElements = [
|
|
294
|
+
...descendants(el, TABLE, 'table-row'),
|
|
295
|
+
];
|
|
296
|
+
const headerRows = new Set(children(el, TABLE, 'table-header-rows').flatMap((h) => descendants(h, TABLE, 'table-row')));
|
|
297
|
+
let headerCount = 0;
|
|
298
|
+
for (const tr of rowElements) {
|
|
299
|
+
const cells = [];
|
|
300
|
+
for (const tc of children(tr, TABLE, 'table-cell')) {
|
|
301
|
+
const runs = [];
|
|
302
|
+
for (const p of [...children(tc, TEXT, 'p'), ...children(tc, TEXT, 'h')]) {
|
|
303
|
+
if (runs.length)
|
|
304
|
+
runs.push({ text: '\n' });
|
|
305
|
+
runs.push(...(await readRuns(p, ctx)));
|
|
306
|
+
}
|
|
307
|
+
// A repeated cell is how ODF stores a run of identical ones — usually the
|
|
308
|
+
// empty tail of a row. Expanded, but capped: a spreadsheet-shaped ODT can
|
|
309
|
+
// claim 16,384 repeats of one blank cell, and honouring that literally
|
|
310
|
+
// builds a table nothing can lay out.
|
|
311
|
+
const repeat = Math.min(Number(attr(tc, TABLE, 'number-columns-repeated') ?? '1') || 1, 64);
|
|
312
|
+
for (let i = 0; i < repeat; i += 1)
|
|
313
|
+
cells.push(mergeRuns(runs));
|
|
314
|
+
}
|
|
315
|
+
if (cells.length) {
|
|
316
|
+
rows.push(cells);
|
|
317
|
+
if (headerRows.has(tr))
|
|
318
|
+
headerCount += 1;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (!rows.length)
|
|
322
|
+
return { kind: 'paragraph', runs: [{ text: ' ' }] };
|
|
323
|
+
const useHeader = headerCount > 0 || rows.length > 1;
|
|
324
|
+
return {
|
|
325
|
+
kind: 'table',
|
|
326
|
+
header: useHeader ? rows[0] : null,
|
|
327
|
+
rows: useHeader ? rows.slice(1) : rows,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
async function readImages(el, ctx) {
|
|
331
|
+
const out = [];
|
|
332
|
+
for (const image of descendants(el, DRAW, 'image')) {
|
|
333
|
+
const href = attr(image, XLINK, 'href');
|
|
334
|
+
if (!href || href.startsWith('http'))
|
|
335
|
+
continue;
|
|
336
|
+
const path = href.replace(/^\.\//, '');
|
|
337
|
+
const ext = path.split('.').pop()?.toLowerCase() ?? '';
|
|
338
|
+
const blob = await ctx.zip.blobOf(path, IMAGE_MIME[ext] ?? 'application/octet-stream');
|
|
339
|
+
if (blob) {
|
|
340
|
+
const frame = image.parentElement;
|
|
341
|
+
const alt = frame ? descendant(frame, SVG_NS, 'title')?.textContent ?? '' : '';
|
|
342
|
+
out.push({ kind: 'image', file: blob, alt });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return out;
|
|
346
|
+
}
|
|
347
|
+
const SVG_NS = 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0';
|
|
348
|
+
async function readMeta(zip, doc) {
|
|
349
|
+
const xml = await zip.textOf('meta.xml');
|
|
350
|
+
if (!xml)
|
|
351
|
+
return;
|
|
352
|
+
const meta = parseXml(xml, 'metadata');
|
|
353
|
+
doc.title = descendant(meta, DC, 'title')?.textContent?.trim() || undefined;
|
|
354
|
+
doc.author =
|
|
355
|
+
descendant(meta, META, 'initial-creator')?.textContent?.trim() ||
|
|
356
|
+
descendant(meta, DC, 'creator')?.textContent?.trim() ||
|
|
357
|
+
undefined;
|
|
358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