postext-idml 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +72 -2
- package/dist/export/colours.d.ts +14 -0
- package/dist/export/colours.d.ts.map +1 -0
- package/dist/export/colours.js +53 -0
- package/dist/export/colours.js.map +1 -0
- package/dist/export/document.d.ts +19 -0
- package/dist/export/document.d.ts.map +1 -0
- package/dist/export/document.js +110 -0
- package/dist/export/document.js.map +1 -0
- package/dist/export/fields.d.ts +19 -0
- package/dist/export/fields.d.ts.map +1 -0
- package/dist/export/fields.js +76 -0
- package/dist/export/fields.js.map +1 -0
- package/dist/export/fonts.d.ts +21 -0
- package/dist/export/fonts.d.ts.map +1 -0
- package/dist/export/fonts.js +56 -0
- package/dist/export/fonts.js.map +1 -0
- package/dist/export/geometry.d.ts +25 -0
- package/dist/export/geometry.d.ts.map +1 -0
- package/dist/export/geometry.js +37 -0
- package/dist/export/geometry.js.map +1 -0
- package/dist/export/idml.test.d.ts +2 -0
- package/dist/export/idml.test.d.ts.map +1 -0
- package/dist/export/idml.test.js +521 -0
- package/dist/export/idml.test.js.map +1 -0
- package/dist/export/images.d.ts +6 -0
- package/dist/export/images.d.ts.map +1 -0
- package/dist/export/images.js +75 -0
- package/dist/export/images.js.map +1 -0
- package/dist/export/index.d.ts +5 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +145 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/inline.d.ts +6 -0
- package/dist/export/inline.d.ts.map +1 -0
- package/dist/export/inline.js +68 -0
- package/dist/export/inline.js.map +1 -0
- package/dist/export/keptLines.d.ts +31 -0
- package/dist/export/keptLines.d.ts.map +1 -0
- package/dist/export/keptLines.js +141 -0
- package/dist/export/keptLines.js.map +1 -0
- package/dist/export/keptLines.test.d.ts +2 -0
- package/dist/export/keptLines.test.d.ts.map +1 -0
- package/dist/export/keptLines.test.js +151 -0
- package/dist/export/keptLines.test.js.map +1 -0
- package/dist/export/paragraphs.d.ts +52 -0
- package/dist/export/paragraphs.d.ts.map +1 -0
- package/dist/export/paragraphs.js +294 -0
- package/dist/export/paragraphs.js.map +1 -0
- package/dist/export/parts.d.ts +114 -0
- package/dist/export/parts.d.ts.map +1 -0
- package/dist/export/parts.js +143 -0
- package/dist/export/parts.js.map +1 -0
- package/dist/export/sfnt.d.ts +19 -0
- package/dist/export/sfnt.d.ts.map +1 -0
- package/dist/export/sfnt.js +109 -0
- package/dist/export/sfnt.js.map +1 -0
- package/dist/export/sfnt.test.d.ts +2 -0
- package/dist/export/sfnt.test.d.ts.map +1 -0
- package/dist/export/sfnt.test.js +58 -0
- package/dist/export/sfnt.test.js.map +1 -0
- package/dist/export/shapes.d.ts +21 -0
- package/dist/export/shapes.d.ts.map +1 -0
- package/dist/export/shapes.js +146 -0
- package/dist/export/shapes.js.map +1 -0
- package/dist/export/spreads.d.ts +25 -0
- package/dist/export/spreads.d.ts.map +1 -0
- package/dist/export/spreads.js +193 -0
- package/dist/export/spreads.js.map +1 -0
- package/dist/export/story.d.ts +38 -0
- package/dist/export/story.d.ts.map +1 -0
- package/dist/export/story.js +271 -0
- package/dist/export/story.js.map +1 -0
- package/dist/export/tables.d.ts +10 -0
- package/dist/export/tables.d.ts.map +1 -0
- package/dist/export/tables.js +95 -0
- package/dist/export/tables.js.map +1 -0
- package/dist/export/writer.d.ts +141 -0
- package/dist/export/writer.d.ts.map +1 -0
- package/dist/export/writer.js +10 -0
- package/dist/export/writer.js.map +1 -0
- package/dist/import/blocks.d.ts +33 -0
- package/dist/import/blocks.d.ts.map +1 -0
- package/dist/import/blocks.js +210 -0
- package/dist/import/blocks.js.map +1 -0
- package/dist/import/context.d.ts +83 -0
- package/dist/import/context.d.ts.map +1 -0
- package/dist/import/context.js +147 -0
- package/dist/import/context.js.map +1 -0
- package/dist/import/decide.d.ts +9 -0
- package/dist/import/decide.d.ts.map +1 -0
- package/dist/import/decide.js +61 -0
- package/dist/import/decide.js.map +1 -0
- package/dist/import/design.d.ts +33 -0
- package/dist/import/design.d.ts.map +1 -0
- package/dist/import/design.js +220 -0
- package/dist/import/design.js.map +1 -0
- package/dist/import/escape.d.ts +33 -0
- package/dist/import/escape.d.ts.map +1 -0
- package/dist/import/escape.js +106 -0
- package/dist/import/escape.js.map +1 -0
- package/dist/import/flow.d.ts +22 -0
- package/dist/import/flow.d.ts.map +1 -0
- package/dist/import/flow.js +329 -0
- package/dist/import/flow.js.map +1 -0
- package/dist/import/hooks.d.ts +6 -0
- package/dist/import/hooks.d.ts.map +1 -0
- package/dist/import/hooks.js +101 -0
- package/dist/import/hooks.js.map +1 -0
- package/dist/import/index.d.ts +24 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +210 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/inline.d.ts +62 -0
- package/dist/import/inline.d.ts.map +1 -0
- package/dist/import/inline.js +395 -0
- package/dist/import/inline.js.map +1 -0
- package/dist/import/looks.d.ts +57 -0
- package/dist/import/looks.d.ts.map +1 -0
- package/dist/import/looks.js +259 -0
- package/dist/import/looks.js.map +1 -0
- package/dist/import/marks.d.ts +33 -0
- package/dist/import/marks.d.ts.map +1 -0
- package/dist/import/marks.js +190 -0
- package/dist/import/marks.js.map +1 -0
- package/dist/import/nested.d.ts +7 -0
- package/dist/import/nested.d.ts.map +1 -0
- package/dist/import/nested.js +122 -0
- package/dist/import/nested.js.map +1 -0
- package/dist/import/objects.d.ts +27 -0
- package/dist/import/objects.d.ts.map +1 -0
- package/dist/import/objects.js +84 -0
- package/dist/import/objects.js.map +1 -0
- package/dist/import/pages.d.ts +12 -0
- package/dist/import/pages.d.ts.map +1 -0
- package/dist/import/pages.js +294 -0
- package/dist/import/pages.js.map +1 -0
- package/dist/import/pagesetup.d.ts +24 -0
- package/dist/import/pagesetup.d.ts.map +1 -0
- package/dist/import/pagesetup.js +138 -0
- package/dist/import/pagesetup.js.map +1 -0
- package/dist/import/pictures.d.ts +25 -0
- package/dist/import/pictures.d.ts.map +1 -0
- package/dist/import/pictures.js +167 -0
- package/dist/import/pictures.js.map +1 -0
- package/dist/import/report.d.ts +12 -0
- package/dist/import/report.d.ts.map +1 -0
- package/dist/import/report.js +39 -0
- package/dist/import/report.js.map +1 -0
- package/dist/import/scan.d.ts +26 -0
- package/dist/import/scan.d.ts.map +1 -0
- package/dist/import/scan.js +147 -0
- package/dist/import/scan.js.map +1 -0
- package/dist/import/styleconfig.d.ts +6 -0
- package/dist/import/styleconfig.d.ts.map +1 -0
- package/dist/import/styleconfig.js +269 -0
- package/dist/import/styleconfig.js.map +1 -0
- package/dist/import/tables.d.ts +8 -0
- package/dist/import/tables.d.ts.map +1 -0
- package/dist/import/tables.js +210 -0
- package/dist/import/tables.js.map +1 -0
- package/dist/import/tests/hostile.test.d.ts +2 -0
- package/dist/import/tests/hostile.test.d.ts.map +1 -0
- package/dist/import/tests/hostile.test.js +106 -0
- package/dist/import/tests/hostile.test.js.map +1 -0
- package/dist/import/tests/kit.test-helper.d.ts +32 -0
- package/dist/import/tests/kit.test-helper.d.ts.map +1 -0
- package/dist/import/tests/kit.test-helper.js +41 -0
- package/dist/import/tests/kit.test-helper.js.map +1 -0
- package/dist/import/tests/reference.test.d.ts +2 -0
- package/dist/import/tests/reference.test.d.ts.map +1 -0
- package/dist/import/tests/reference.test.js +184 -0
- package/dist/import/tests/reference.test.js.map +1 -0
- package/dist/import/tests/safety.test.d.ts +2 -0
- package/dist/import/tests/safety.test.d.ts.map +1 -0
- package/dist/import/tests/safety.test.js +82 -0
- package/dist/import/tests/safety.test.js.map +1 -0
- package/dist/import/tests/text.test.d.ts +2 -0
- package/dist/import/tests/text.test.d.ts.map +1 -0
- package/dist/import/tests/text.test.js +160 -0
- package/dist/import/tests/text.test.js.map +1 -0
- package/dist/import/types.d.ts +114 -0
- package/dist/import/types.d.ts.map +1 -0
- package/dist/import/types.js +3 -0
- package/dist/import/types.js.map +1 -0
- package/dist/import/values.d.ts +31 -0
- package/dist/import/values.d.ts.map +1 -0
- package/dist/import/values.js +108 -0
- package/dist/import/values.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/model/document.d.ts +522 -0
- package/dist/model/document.d.ts.map +1 -0
- package/dist/model/document.js +4 -0
- package/dist/model/document.js.map +1 -0
- package/dist/model/geometry.d.ts +58 -0
- package/dist/model/geometry.d.ts.map +1 -0
- package/dist/model/geometry.js +92 -0
- package/dist/model/geometry.js.map +1 -0
- package/dist/package/errors.d.ts +8 -0
- package/dist/package/errors.d.ts.map +1 -0
- package/dist/package/errors.js +15 -0
- package/dist/package/errors.js.map +1 -0
- package/dist/package/open.d.ts +22 -0
- package/dist/package/open.d.ts.map +1 -0
- package/dist/package/open.js +114 -0
- package/dist/package/open.js.map +1 -0
- package/dist/read/designmap.d.ts +13 -0
- package/dist/read/designmap.d.ts.map +1 -0
- package/dist/read/designmap.js +246 -0
- package/dist/read/designmap.js.map +1 -0
- package/dist/read/fixture.test-helper.d.ts +33 -0
- package/dist/read/fixture.test-helper.d.ts.map +1 -0
- package/dist/read/fixture.test-helper.js +81 -0
- package/dist/read/fixture.test-helper.js.map +1 -0
- package/dist/read/hostile.test.d.ts +2 -0
- package/dist/read/hostile.test.d.ts.map +1 -0
- package/dist/read/hostile.test.js +333 -0
- package/dist/read/hostile.test.js.map +1 -0
- package/dist/read/index.d.ts +21 -0
- package/dist/read/index.d.ts.map +1 -0
- package/dist/read/index.js +214 -0
- package/dist/read/index.js.map +1 -0
- package/dist/read/items.d.ts +8 -0
- package/dist/read/items.d.ts.map +1 -0
- package/dist/read/items.js +215 -0
- package/dist/read/items.js.map +1 -0
- package/dist/read/languages.d.ts +5 -0
- package/dist/read/languages.d.ts.map +1 -0
- package/dist/read/languages.js +39 -0
- package/dist/read/languages.js.map +1 -0
- package/dist/read/preferences.d.ts +9 -0
- package/dist/read/preferences.d.ts.map +1 -0
- package/dist/read/preferences.js +74 -0
- package/dist/read/preferences.js.map +1 -0
- package/dist/read/props.d.ts +31 -0
- package/dist/read/props.d.ts.map +1 -0
- package/dist/read/props.js +94 -0
- package/dist/read/props.js.map +1 -0
- package/dist/read/reference.test.d.ts +2 -0
- package/dist/read/reference.test.d.ts.map +1 -0
- package/dist/read/reference.test.js +428 -0
- package/dist/read/reference.test.js.map +1 -0
- package/dist/read/resources.d.ts +9 -0
- package/dist/read/resources.d.ts.map +1 -0
- package/dist/read/resources.js +129 -0
- package/dist/read/resources.js.map +1 -0
- package/dist/read/spreads.d.ts +12 -0
- package/dist/read/spreads.d.ts.map +1 -0
- package/dist/read/spreads.js +94 -0
- package/dist/read/spreads.js.map +1 -0
- package/dist/read/story.d.ts +22 -0
- package/dist/read/story.d.ts.map +1 -0
- package/dist/read/story.js +325 -0
- package/dist/read/story.js.map +1 -0
- package/dist/read/story.test.d.ts +2 -0
- package/dist/read/story.test.d.ts.map +1 -0
- package/dist/read/story.test.js +99 -0
- package/dist/read/story.test.js.map +1 -0
- package/dist/read/styles.d.ts +6 -0
- package/dist/read/styles.d.ts.map +1 -0
- package/dist/read/styles.js +122 -0
- package/dist/read/styles.js.map +1 -0
- package/dist/read/tables.d.ts +10 -0
- package/dist/read/tables.d.ts.map +1 -0
- package/dist/read/tables.js +88 -0
- package/dist/read/tables.js.map +1 -0
- package/dist/resolve/colour.d.ts +39 -0
- package/dist/resolve/colour.d.ts.map +1 -0
- package/dist/resolve/colour.js +135 -0
- package/dist/resolve/colour.js.map +1 -0
- package/dist/resolve/format.d.ts +140 -0
- package/dist/resolve/format.d.ts.map +1 -0
- package/dist/resolve/format.js +232 -0
- package/dist/resolve/format.js.map +1 -0
- package/dist/resolve/geometry.d.ts +102 -0
- package/dist/resolve/geometry.d.ts.map +1 -0
- package/dist/resolve/geometry.js +192 -0
- package/dist/resolve/geometry.js.map +1 -0
- package/dist/resolve/index.d.ts +14 -0
- package/dist/resolve/index.d.ts.map +1 -0
- package/dist/resolve/index.js +10 -0
- package/dist/resolve/index.js.map +1 -0
- package/dist/resolve/inspect.d.ts +109 -0
- package/dist/resolve/inspect.d.ts.map +1 -0
- package/dist/resolve/inspect.js +319 -0
- package/dist/resolve/inspect.js.map +1 -0
- package/dist/resolve/masters.d.ts +23 -0
- package/dist/resolve/masters.d.ts.map +1 -0
- package/dist/resolve/masters.js +99 -0
- package/dist/resolve/masters.js.map +1 -0
- package/dist/resolve/order.d.ts +65 -0
- package/dist/resolve/order.d.ts.map +1 -0
- package/dist/resolve/order.js +292 -0
- package/dist/resolve/order.js.map +1 -0
- package/dist/resolve/reference.test.d.ts +2 -0
- package/dist/resolve/reference.test.d.ts.map +1 -0
- package/dist/resolve/reference.test.js +342 -0
- package/dist/resolve/reference.test.js.map +1 -0
- package/dist/resolve/styles.d.ts +26 -0
- package/dist/resolve/styles.d.ts.map +1 -0
- package/dist/resolve/styles.js +124 -0
- package/dist/resolve/styles.js.map +1 -0
- package/dist/roundtrip.test.d.ts +2 -0
- package/dist/roundtrip.test.d.ts.map +1 -0
- package/dist/roundtrip.test.js +89 -0
- package/dist/roundtrip.test.js.map +1 -0
- package/dist/testing/kit.test-helper.d.ts +9 -0
- package/dist/testing/kit.test-helper.d.ts.map +1 -0
- package/dist/testing/kit.test-helper.js +32 -0
- package/dist/testing/kit.test-helper.js.map +1 -0
- package/dist/xml/read.d.ts +48 -0
- package/dist/xml/read.d.ts.map +1 -0
- package/dist/xml/read.js +212 -0
- package/dist/xml/read.js.map +1 -0
- package/dist/xml/write.d.ts +9 -0
- package/dist/xml/write.d.ts.map +1 -0
- package/dist/xml/write.js +24 -0
- package/dist/xml/write.js.map +1 -0
- package/package.json +65 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// What the exporter writes, the reader reads back: the package of a
|
|
2
|
+
// laid-out book holds its pages, its text in order and its styles, with
|
|
3
|
+
// nothing the reader has to warn about.
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { pageDisplayList } from 'postext';
|
|
6
|
+
import { build, config, mm, LOREM } from './testing/kit.test-helper.js';
|
|
7
|
+
import { idmlDocument, idmlToPostext, inspectIdml, plainText, readIdml, readingOrder } from './index.js';
|
|
8
|
+
const MD = `# First chapter\n\n${LOREM}\n\nA second paragraph with *italic* and **bold** words, and a [link](https://postext.dev/).\n\n- one\n- two\n\n## A section\n\n${Array(12).fill(LOREM).join('\n\n')}\n`;
|
|
9
|
+
describe('export → read', () => {
|
|
10
|
+
const cfg = config({ page: { dpi: 72, width: mm(140), height: mm(200), margins: { top: mm(15), bottom: mm(20), left: mm(18), right: mm(12), mirror: true } } });
|
|
11
|
+
const doc = build(MD, cfg);
|
|
12
|
+
const { bytes } = idmlDocument({ docs: [doc], title: 'Round trip' });
|
|
13
|
+
const idml = readIdml(bytes);
|
|
14
|
+
it('reads the package without a warning', () => {
|
|
15
|
+
expect(idml.warnings).toEqual([]);
|
|
16
|
+
expect(idml.name).toBe('Round trip');
|
|
17
|
+
});
|
|
18
|
+
it('holds every page, two to a spread about the spine after the first', () => {
|
|
19
|
+
const pages = idml.spreads.flatMap((s) => s.pages);
|
|
20
|
+
expect(pages).toHaveLength(doc.pages.length);
|
|
21
|
+
expect(doc.pages.length).toBeGreaterThan(2);
|
|
22
|
+
expect(idml.preferences.facingPages).toBe(true);
|
|
23
|
+
expect(idml.spreads[0].pages).toHaveLength(1);
|
|
24
|
+
expect(idml.spreads[1].pages).toHaveLength(2);
|
|
25
|
+
expect(idml.spreads[1].pages.map((p) => p.side)).toEqual(['left', 'right']);
|
|
26
|
+
// Mirrored margins: the inside one is the wider (18 mm) on both sides.
|
|
27
|
+
for (const p of pages)
|
|
28
|
+
expect(p.margins.left).toBeCloseTo((18 * 72) / 25.4, 1);
|
|
29
|
+
expect(pages[0].bounds.right - pages[0].bounds.left).toBeCloseTo((140 * 72) / 25.4, 2);
|
|
30
|
+
});
|
|
31
|
+
it('keeps the words of every text item, in page order', () => {
|
|
32
|
+
const order = readingOrder(idml);
|
|
33
|
+
const read = order.map((o) => plainText(o.story.paragraphs)).join('\n').replace(/[\u2028\n\t]+/g, ' ').replace(/\s+/g, ' ');
|
|
34
|
+
const painted = doc.pages
|
|
35
|
+
.flatMap((_, p) => pageDisplayList(doc, p).items)
|
|
36
|
+
.flatMap((i) => (i.kind === 'text' ? i.lines.map((l) => l.text) : []))
|
|
37
|
+
.join(' ')
|
|
38
|
+
.replace(/\s+/g, ' ');
|
|
39
|
+
// Every painted word is in the package (the order of frames on a page
|
|
40
|
+
// is the reader's; the words are the same).
|
|
41
|
+
const words = (s) => s.split(' ').filter(Boolean).sort();
|
|
42
|
+
const count = (list) => list.reduce((m, x) => m.set(x, (m.get(x) ?? 0) + 1), new Map());
|
|
43
|
+
const a = count(words(read));
|
|
44
|
+
const b = count(words(painted));
|
|
45
|
+
const off = [...new Set([...a.keys(), ...b.keys()])].filter((k) => a.get(k) !== b.get(k)).map((k) => `${k}: ${a.get(k) ?? 0}/${b.get(k) ?? 0}`);
|
|
46
|
+
expect(off).toEqual([]);
|
|
47
|
+
});
|
|
48
|
+
it('carries the link, the faces and the styles', () => {
|
|
49
|
+
expect(idml.hyperlinks).toHaveLength(1);
|
|
50
|
+
const dest = idml.destinations.get(idml.hyperlinks[0].destination ?? '');
|
|
51
|
+
expect(dest?.url).toBe('https://postext.dev/');
|
|
52
|
+
const summary = inspectIdml(idml);
|
|
53
|
+
expect(summary.pages).toBe(doc.pages.length);
|
|
54
|
+
const styles = [...idml.styles.paragraph.values()].map((s) => s.name);
|
|
55
|
+
expect(styles).toEqual(expect.arrayContaining(['Body', 'Heading 1', 'Heading 2', 'List']));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
// Postext → IDML → Postext: the lines the export kept come back as the
|
|
59
|
+
// lines of the imported book, justified as they were (postext 1.74,
|
|
60
|
+
// `bodyText.justifyHardBreaks`).
|
|
61
|
+
describe('export → import', () => {
|
|
62
|
+
const cfg = config({ page: { dpi: 72, width: mm(140), height: mm(200), margins: { top: mm(15), bottom: mm(20), left: mm(18), right: mm(12) } } });
|
|
63
|
+
const source = build(`${Array(3).fill(LOREM).join('\n\n')}\n`, cfg);
|
|
64
|
+
const { bytes } = idmlDocument({ docs: [source], title: 'Kept lines' });
|
|
65
|
+
const result = idmlToPostext(bytes, { layout: 'pages' });
|
|
66
|
+
it('turns justified forced breaks on and reports nothing about them', () => {
|
|
67
|
+
expect(result.config.bodyText?.justifyHardBreaks).toBe(true);
|
|
68
|
+
expect(result.report.findings.map((f) => f.id)).not.toContain('forcedBreakInJustified');
|
|
69
|
+
});
|
|
70
|
+
it('writes kept lines with ordinary spaces', () => {
|
|
71
|
+
const markdown = result.chapters.map((c) => c.markdown).join('\n');
|
|
72
|
+
expect(markdown).toContain('\\\n');
|
|
73
|
+
expect(markdown).not.toContain('\u00a0');
|
|
74
|
+
});
|
|
75
|
+
it('sets the same lines, justified, when the imported book is laid out', () => {
|
|
76
|
+
const painted = (doc) => doc.pages
|
|
77
|
+
.flatMap((_, p) => pageDisplayList(doc, p).items)
|
|
78
|
+
.flatMap((i) => (i.kind === 'text' ? i.lines : []));
|
|
79
|
+
const before = painted(source).filter((l) => l.text.trim().split(' ').length > 3);
|
|
80
|
+
const again = build(result.chapters.map((c) => c.markdown).join('\n\n'), result.config);
|
|
81
|
+
const after = painted(again).filter((l) => l.text.trim().split(' ').length > 3);
|
|
82
|
+
expect(after.map((l) => l.text.trim())).toEqual(before.map((l) => l.text.trim()));
|
|
83
|
+
// Every line but a paragraph's last fills the measure, as in the source.
|
|
84
|
+
const full = (lines) => lines.filter((l) => !l.last).length;
|
|
85
|
+
expect(full(after)).toBe(full(before));
|
|
86
|
+
expect(full(after)).toBeGreaterThan(10);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=roundtrip.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundtrip.test.js","sourceRoot":"","sources":["../src/roundtrip.test.ts"],"names":[],"m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CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PostextConfig, Resource, VDTDocument } from 'postext';
|
|
2
|
+
export declare const mm: (value: number) => {
|
|
3
|
+
value: number;
|
|
4
|
+
unit: "mm";
|
|
5
|
+
};
|
|
6
|
+
export declare const LOREM = "Typesetting is the composition of text by means of arranging physical type or its digital equivalents. Stored letters and other symbols are retrieved and ordered according to the language orthography for visual display. Characteristically a justified column of text is set with even spaces between words, and long compound words such as internationalization and representativeness get hyphenated at the end of lines.";
|
|
7
|
+
export declare function config(over?: Partial<PostextConfig>): PostextConfig;
|
|
8
|
+
export declare function build(markdown: string, cfg: PostextConfig, resources?: Resource[]): VDTDocument;
|
|
9
|
+
//# sourceMappingURL=kit.test-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.test-helper.d.ts","sourceRoot":"","sources":["../../src/testing/kit.test-helper.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAepE,eAAO,MAAM,EAAE,GAAI,OAAO,MAAM;;;CAAqC,CAAC;AAEtE,eAAO,MAAM,KAAK,qaAAqa,CAAC;AAExb,wBAAgB,MAAM,CAAC,IAAI,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,aAAa,CAUvE;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,WAAW,CAE/F"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Test kit: small laid-out documents with a deterministic measurer, built
|
|
2
|
+
// with the engine's public API only.
|
|
3
|
+
import { buildDocument } from 'postext';
|
|
4
|
+
// Deterministic stub: every character is 7 px wide, bold ones 8 px.
|
|
5
|
+
class StubCtx {
|
|
6
|
+
font = '';
|
|
7
|
+
measureText(s) {
|
|
8
|
+
return { width: s.length * (/bold|700/.test(this.font) ? 8 : 7) };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
globalThis.OffscreenCanvas = class {
|
|
12
|
+
getContext() {
|
|
13
|
+
return new StubCtx();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const mm = (value) => ({ value, unit: 'mm' });
|
|
17
|
+
export const LOREM = 'Typesetting is the composition of text by means of arranging physical type or its digital equivalents. Stored letters and other symbols are retrieved and ordered according to the language orthography for visual display. Characteristically a justified column of text is set with even spaces between words, and long compound words such as internationalization and representativeness get hyphenated at the end of lines.';
|
|
18
|
+
export function config(over = {}) {
|
|
19
|
+
return {
|
|
20
|
+
page: { dpi: 72, width: mm(140), height: mm(200), margins: { top: mm(10), bottom: mm(10), left: mm(10), right: mm(10) } },
|
|
21
|
+
layout: { layoutType: 'single' },
|
|
22
|
+
bodyText: { textAlign: 'justify', firstLineIndent: mm(0), hyphenation: { enabled: true } },
|
|
23
|
+
headings: { balancing: { enabled: false } },
|
|
24
|
+
header: { elements: [] },
|
|
25
|
+
footer: { elements: [] },
|
|
26
|
+
...over,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function build(markdown, cfg, resources) {
|
|
30
|
+
return buildDocument({ markdown, ...(resources ? { resources } : {}) }, cfg);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=kit.test-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.test-helper.js","sourceRoot":"","sources":["../../src/testing/kit.test-helper.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,oEAAoE;AACpE,MAAM,OAAO;IACX,IAAI,GAAG,EAA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AE,EAAE;QACxB,GAAG,IAAI;KACS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,GAAkB,EAAE,SAAsB;IAChF,OAAO,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface XmlElement {
|
|
2
|
+
/** Qualified name as written (`idPkg:Story`, `ParagraphStyleRange`). */
|
|
3
|
+
name: string;
|
|
4
|
+
attrs: Record<string, string>;
|
|
5
|
+
children: XmlNode[];
|
|
6
|
+
}
|
|
7
|
+
/** A processing instruction (`<?ACE 4?>`: target `ACE`, data `4`). */
|
|
8
|
+
export interface XmlInstruction {
|
|
9
|
+
pi: string;
|
|
10
|
+
data: string;
|
|
11
|
+
}
|
|
12
|
+
export type XmlNode = XmlElement | XmlInstruction | string;
|
|
13
|
+
export declare class XmlError extends Error {
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
export declare const isElement: (n: XmlNode | undefined) => n is XmlElement;
|
|
17
|
+
export declare const isInstruction: (n: XmlNode | undefined) => n is XmlInstruction;
|
|
18
|
+
export declare function decodeEntities(s: string): string;
|
|
19
|
+
/** The local part of a qualified name (`idPkg:Story` → `Story`). */
|
|
20
|
+
export declare const localName: (name: string) => string;
|
|
21
|
+
export interface ParseXmlOptions {
|
|
22
|
+
/** Deepest nesting read (default 256); deeper is an {@link XmlError}. */
|
|
23
|
+
maxDepth?: number;
|
|
24
|
+
/** The document's own instructions before the root (`<?aid … ?>`) are
|
|
25
|
+
* handed here. */
|
|
26
|
+
onProlog?: (pi: XmlInstruction) => void;
|
|
27
|
+
}
|
|
28
|
+
/** Parse an XML part; returns its root element. Whitespace-only text
|
|
29
|
+
* between elements is dropped (IDML has no mixed content outside
|
|
30
|
+
* `Content`, whose text is kept as written). */
|
|
31
|
+
export declare function parseXml(source: string, options?: ParseXmlOptions): XmlElement;
|
|
32
|
+
/** Child elements of `el` (with this local name when given). */
|
|
33
|
+
export declare function children(el: XmlElement | undefined, local?: string): XmlElement[];
|
|
34
|
+
/** The first child element of `el` with this local name. */
|
|
35
|
+
export declare function child(el: XmlElement | undefined, local: string): XmlElement | undefined;
|
|
36
|
+
/** Every descendant element with this local name, in document order. */
|
|
37
|
+
export declare function descendants(el: XmlElement, local: string, out?: XmlElement[]): XmlElement[];
|
|
38
|
+
/** The concatenated text of an element (instructions left out). */
|
|
39
|
+
export declare function textOf(el: XmlElement | undefined): string;
|
|
40
|
+
/** A property of an element's `<Properties>` child, by name. */
|
|
41
|
+
export declare function property(el: XmlElement | undefined, name: string): XmlElement | undefined;
|
|
42
|
+
/** Attribute readers: absent or unreadable is `undefined`. */
|
|
43
|
+
export declare const str: (el: XmlElement | undefined, name: string) => string | undefined;
|
|
44
|
+
export declare function num(el: XmlElement | undefined, name: string): number | undefined;
|
|
45
|
+
export declare function bool(el: XmlElement | undefined, name: string): boolean | undefined;
|
|
46
|
+
/** A list of numbers in one attribute (`"0 0 792 612"`). */
|
|
47
|
+
export declare function nums(el: XmlElement | undefined, name: string): number[] | undefined;
|
|
48
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/xml/read.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,OAAO,G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AAS,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEzF;AAED,8DAA8D;AAC9D,eAAO,MAAM,GAAG,GAAI,IAAI,UAAU,GAAG,SAAS,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,SAA4B,CAAC;AACrG,wBAAgB,GAAG,CAAC,EAAE,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKhF;AACD,wBAAgB,IAAI,CAAC,EAAE,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAGlF;AACD,4DAA4D;AAC5D,wBAAgB,IAAI,CAAC,EAAE,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAKnF"}
|
package/dist/xml/read.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// The XML reader of the IDML parts. No DOMParser, so it runs in Node, in
|
|
2
|
+
// workers and in the browser alike. It reads what InDesign writes and
|
|
3
|
+
// keeps what an IDML story needs that a plain reader drops: processing
|
|
4
|
+
// instructions inside text (`<?ACE 4?>`, the special characters of a
|
|
5
|
+
// story) and the document's own instruction (`<?aid … ?>`).
|
|
6
|
+
//
|
|
7
|
+
// Linear in the size of the source whatever it holds: a tag that fails
|
|
8
|
+
// reads no further than the next `<`, a closing mark that is not there is
|
|
9
|
+
// looked for once. Entities are the five of XML and character references;
|
|
10
|
+
// a DOCTYPE is skipped, never expanded.
|
|
11
|
+
export class XmlError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'XmlError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const isElement = (n) => typeof n === 'object' && n !== null && 'name' in n;
|
|
18
|
+
export const isInstruction = (n) => typeof n === 'object' && n !== null && 'pi' in n;
|
|
19
|
+
const NAMED_ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
|
|
20
|
+
export function decodeEntities(s) {
|
|
21
|
+
if (!s.includes('&'))
|
|
22
|
+
return s;
|
|
23
|
+
return s.replace(/&(#x[0-9a-fA-F]{1,6}|#[0-9]{1,7}|[a-zA-Z]{2,8});/g, (m, body) => {
|
|
24
|
+
if (body[0] === '#') {
|
|
25
|
+
const code = body[1] === 'x' || body[1] === 'X' ? parseInt(body.slice(2), 16) : parseInt(body.slice(1), 10);
|
|
26
|
+
return Number.isFinite(code) && code > 0 && code <= 0x10ffff && !(code >= 0xd800 && code <= 0xdfff) ? String.fromCodePoint(code) : m;
|
|
27
|
+
}
|
|
28
|
+
return NAMED_ENTITIES[body] ?? m;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** The local part of a qualified name (`idPkg:Story` → `Story`). */
|
|
32
|
+
export const localName = (name) => name.slice(name.indexOf(':') + 1);
|
|
33
|
+
// `<` stands in no name and no attribute value, so a tag that fails has
|
|
34
|
+
// read no further than the next `<`.
|
|
35
|
+
const TAG = /<\/([^\s<>]+)\s*>|<([^\s/<>!?]+)((?:\s+[^\s=/<>]+\s*=\s*(?:"[^"<]*"|'[^'<]*'))*)\s*(\/?)>/y;
|
|
36
|
+
const ATTR = /([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
|
|
37
|
+
/** Parse an XML part; returns its root element. Whitespace-only text
|
|
38
|
+
* between elements is dropped (IDML has no mixed content outside
|
|
39
|
+
* `Content`, whose text is kept as written). */
|
|
40
|
+
export function parseXml(source, options = {}) {
|
|
41
|
+
const maxDepth = options.maxDepth ?? 256;
|
|
42
|
+
const root = { name: '#document', attrs: {}, children: [] };
|
|
43
|
+
const stack = [root];
|
|
44
|
+
const absent = new Set();
|
|
45
|
+
const past = (mark, from) => {
|
|
46
|
+
if (absent.has(mark))
|
|
47
|
+
return -1;
|
|
48
|
+
const at = source.indexOf(mark, from);
|
|
49
|
+
if (at < 0)
|
|
50
|
+
absent.add(mark);
|
|
51
|
+
return at < 0 ? -1 : at + mark.length;
|
|
52
|
+
};
|
|
53
|
+
const top = () => stack[stack.length - 1];
|
|
54
|
+
const text = (from, to) => {
|
|
55
|
+
if (to <= from)
|
|
56
|
+
return;
|
|
57
|
+
const raw = source.slice(from, to);
|
|
58
|
+
const t = top();
|
|
59
|
+
// Text is content only where IDML holds text.
|
|
60
|
+
if (KEEPS_TEXT.has(localName(t.name)) || /\S/.test(raw))
|
|
61
|
+
t.children.push(decodeEntities(raw));
|
|
62
|
+
};
|
|
63
|
+
let last = 0;
|
|
64
|
+
for (let i = source.indexOf('<'); i >= 0;) {
|
|
65
|
+
let end = -1;
|
|
66
|
+
const next = source[i + 1];
|
|
67
|
+
if (next === '!') {
|
|
68
|
+
if (source.startsWith('<![CDATA[', i)) {
|
|
69
|
+
end = past(']]>', i + 9);
|
|
70
|
+
if (end >= 0) {
|
|
71
|
+
text(last, i);
|
|
72
|
+
top().children.push(source.slice(i + 9, end - 3));
|
|
73
|
+
last = end;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
end = source.startsWith('<!--', i) ? past('-->', i + 4) : past('>', i + 2);
|
|
78
|
+
if (end >= 0) {
|
|
79
|
+
text(last, i);
|
|
80
|
+
last = end;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (next === '?') {
|
|
85
|
+
end = past('?>', i + 2);
|
|
86
|
+
if (end >= 0) {
|
|
87
|
+
text(last, i);
|
|
88
|
+
last = end;
|
|
89
|
+
const body = source.slice(i + 2, end - 2);
|
|
90
|
+
const sp = body.search(/\s/);
|
|
91
|
+
const pi = { pi: sp < 0 ? body : body.slice(0, sp), data: sp < 0 ? '' : body.slice(sp + 1).trim() };
|
|
92
|
+
if (stack.length === 1) {
|
|
93
|
+
if (pi.pi.toLowerCase() !== 'xml')
|
|
94
|
+
options.onProlog?.(pi);
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
top().children.push(pi);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
TAG.lastIndex = i;
|
|
102
|
+
const m = TAG.exec(source);
|
|
103
|
+
if (m) {
|
|
104
|
+
end = TAG.lastIndex;
|
|
105
|
+
text(last, i);
|
|
106
|
+
last = end;
|
|
107
|
+
const [, close, open, attrs, self] = m;
|
|
108
|
+
if (close !== undefined) {
|
|
109
|
+
let at = stack.length - 1;
|
|
110
|
+
while (at > 0 && stack[at].name !== close)
|
|
111
|
+
at--;
|
|
112
|
+
if (at > 0)
|
|
113
|
+
stack.length = at;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const el = { name: open, attrs: {}, children: [] };
|
|
117
|
+
if (attrs) {
|
|
118
|
+
ATTR.lastIndex = 0;
|
|
119
|
+
let a;
|
|
120
|
+
while ((a = ATTR.exec(attrs)))
|
|
121
|
+
el.attrs[a[1]] = decodeEntities(a[2] ?? a[3] ?? '');
|
|
122
|
+
}
|
|
123
|
+
top().children.push(el);
|
|
124
|
+
if (!self) {
|
|
125
|
+
if (stack.length > maxDepth)
|
|
126
|
+
throw new XmlError(`XML nested deeper than ${maxDepth} elements`);
|
|
127
|
+
stack.push(el);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
i = source.indexOf('<', end >= 0 ? end : i + 1);
|
|
133
|
+
}
|
|
134
|
+
text(last, source.length);
|
|
135
|
+
const first = root.children.find(isElement);
|
|
136
|
+
if (!first)
|
|
137
|
+
throw new XmlError('no root element');
|
|
138
|
+
return first;
|
|
139
|
+
}
|
|
140
|
+
/** Elements whose text is content, kept with its spaces. */
|
|
141
|
+
const KEEPS_TEXT = new Set(['Content', 'Contents', 'Data', 'GrPr', 'MojikumiTable']);
|
|
142
|
+
/** Child elements of `el` (with this local name when given). */
|
|
143
|
+
export function children(el, local) {
|
|
144
|
+
if (!el)
|
|
145
|
+
return [];
|
|
146
|
+
const out = [];
|
|
147
|
+
for (const c of el.children)
|
|
148
|
+
if (isElement(c) && (local === undefined || localName(c.name) === local))
|
|
149
|
+
out.push(c);
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
/** The first child element of `el` with this local name. */
|
|
153
|
+
export function child(el, local) {
|
|
154
|
+
if (!el)
|
|
155
|
+
return undefined;
|
|
156
|
+
for (const c of el.children)
|
|
157
|
+
if (isElement(c) && localName(c.name) === local)
|
|
158
|
+
return c;
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
/** Every descendant element with this local name, in document order. */
|
|
162
|
+
export function descendants(el, local, out = []) {
|
|
163
|
+
const stack = [el];
|
|
164
|
+
const order = [];
|
|
165
|
+
while (stack.length) {
|
|
166
|
+
const e = stack.pop();
|
|
167
|
+
if (e !== el && localName(e.name) === local)
|
|
168
|
+
order.push(e);
|
|
169
|
+
for (let i = e.children.length - 1; i >= 0; i--) {
|
|
170
|
+
const c = e.children[i];
|
|
171
|
+
if (isElement(c))
|
|
172
|
+
stack.push(c);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
out.push(...order);
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
/** The concatenated text of an element (instructions left out). */
|
|
179
|
+
export function textOf(el) {
|
|
180
|
+
if (!el)
|
|
181
|
+
return '';
|
|
182
|
+
let out = '';
|
|
183
|
+
for (const c of el.children)
|
|
184
|
+
out += typeof c === 'string' ? c : isElement(c) ? textOf(c) : '';
|
|
185
|
+
return out;
|
|
186
|
+
}
|
|
187
|
+
/** A property of an element's `<Properties>` child, by name. */
|
|
188
|
+
export function property(el, name) {
|
|
189
|
+
return child(child(el, 'Properties'), name);
|
|
190
|
+
}
|
|
191
|
+
/** Attribute readers: absent or unreadable is `undefined`. */
|
|
192
|
+
export const str = (el, name) => el?.attrs[name];
|
|
193
|
+
export function num(el, name) {
|
|
194
|
+
const v = el?.attrs[name];
|
|
195
|
+
if (v === undefined || v === '')
|
|
196
|
+
return undefined;
|
|
197
|
+
const n = Number(v);
|
|
198
|
+
return Number.isFinite(n) ? n : undefined;
|
|
199
|
+
}
|
|
200
|
+
export function bool(el, name) {
|
|
201
|
+
const v = el?.attrs[name];
|
|
202
|
+
return v === 'true' ? true : v === 'false' ? false : undefined;
|
|
203
|
+
}
|
|
204
|
+
/** A list of numbers in one attribute (`"0 0 792 612"`). */
|
|
205
|
+
export function nums(el, name) {
|
|
206
|
+
const v = el?.attrs[name];
|
|
207
|
+
if (v === undefined)
|
|
208
|
+
return undefined;
|
|
209
|
+
const out = v.trim().split(/\s+/).filter(Boolean).map(Number);
|
|
210
|
+
return out.every(Number.isFinite) ? out : undefined;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/xml/read.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,sEAAsE;AACtE,uEAAuE;AACvE,qEAAqE;AACrE,4DAA4D;AAC5D,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,0EAA0E;AAC1E,wCAAwC;AAiBxC,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAsB,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,IAAI,CAAC,CAAC;AACzH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAsB,EAAuB,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC;AAE/H,MAAM,cAAc,GAA2B,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAA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,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Text escaped for an element body. */
|
|
2
|
+
export declare function escapeXml(s: string): string;
|
|
3
|
+
/** Text escaped for a double-quoted attribute value. */
|
|
4
|
+
export declare function escapeAttr(s: string): string;
|
|
5
|
+
/** A number as IDML writes it: up to four decimals, no trailing zeros. */
|
|
6
|
+
export declare function num(n: number): string;
|
|
7
|
+
export declare const attr: (name: string, value: string | number | boolean | undefined) => string;
|
|
8
|
+
export declare const XML_HEAD = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
|
|
9
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/xml/write.ts"],"names":[],"mappings":"AAEA,wCAAwC;AACxC,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO3C;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,0EAA0E;AAC1E,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrC;AAED,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,KAAG,MAC6B,CAAC;AAEhH,eAAO,MAAM,QAAQ,oEAA8D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Writing XML: escaping, numbers and attributes as InDesign writes them.
|
|
2
|
+
/** Text escaped for an element body. */
|
|
3
|
+
export function escapeXml(s) {
|
|
4
|
+
return s
|
|
5
|
+
.replace(/&/g, '&')
|
|
6
|
+
.replace(/</g, '<')
|
|
7
|
+
.replace(/>/g, '>')
|
|
8
|
+
// Characters XML 1.0 does not allow (C0 controls bar tab, LF, CR).
|
|
9
|
+
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, '');
|
|
10
|
+
}
|
|
11
|
+
/** Text escaped for a double-quoted attribute value. */
|
|
12
|
+
export function escapeAttr(s) {
|
|
13
|
+
return escapeXml(s).replace(/"/g, '"').replace(/\t/g, '	').replace(/\n/g, '
').replace(/\r/g, '
');
|
|
14
|
+
}
|
|
15
|
+
/** A number as IDML writes it: up to four decimals, no trailing zeros. */
|
|
16
|
+
export function num(n) {
|
|
17
|
+
if (!Number.isFinite(n))
|
|
18
|
+
return '0';
|
|
19
|
+
const r = Math.round(n * 10000) / 10000;
|
|
20
|
+
return Object.is(r, -0) ? '0' : String(r);
|
|
21
|
+
}
|
|
22
|
+
export const attr = (name, value) => value === undefined ? '' : ` ${name}="${escapeAttr(typeof value === 'number' ? num(value) : String(value))}"`;
|
|
23
|
+
export const XML_HEAD = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
|
|
24
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/xml/write.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,wCAAwC;AACxC,MAAM,UAAU,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC;SACL,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,mEAAmE;SAClE,OAAO,CAAC,6CAA6C,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,GAAG,CAAC,CAAS;IAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;IACxC,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAA4C,EAAU,EAAE,CACzF,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,UAAU,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;AAEhH,MAAM,CAAC,MAAM,QAAQ,GAAG,2DAA2D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postext-idml",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "InDesign Markup (IDML) for Postext, in both directions: a laid-out book as an IDML package that InDesign opens as the PDF shows it, and an IDML package as a Postext book. A typed IDML reader, no dependency on InDesign.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://postext.dev/",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"postext",
|
|
10
|
+
"idml",
|
|
11
|
+
"indesign",
|
|
12
|
+
"import",
|
|
13
|
+
"export",
|
|
14
|
+
"typesetting",
|
|
15
|
+
"typography",
|
|
16
|
+
"print"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/drnachio/postext.git",
|
|
21
|
+
"directory": "packages/postext-idml"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./export": {
|
|
33
|
+
"types": "./dist/export/index.d.ts",
|
|
34
|
+
"default": "./dist/export/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./import": {
|
|
37
|
+
"types": "./dist/import/index.d.ts",
|
|
38
|
+
"default": "./dist/import/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./read": {
|
|
41
|
+
"types": "./dist/read/index.d.ts",
|
|
42
|
+
"default": "./dist/read/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"postext": "^1.76.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"fflate": "^0.8.3"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@postext/typescript-config": "0.0.0",
|
|
54
|
+
"@types/node": "^26.6.5",
|
|
55
|
+
"eslint": "^10.13.0",
|
|
56
|
+
"postext": "1.76.0",
|
|
57
|
+
"typescript": "^6.0.3",
|
|
58
|
+
"typescript-eslint": "^8.72.0",
|
|
59
|
+
"vitest": "^5.0.5"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "rm -rf dist && tsc",
|
|
63
|
+
"dev": "tsc --watch",
|
|
64
|
+
"check-types": "tsc --noEmit",
|
|
65
|
+
"lint": "eslint .",
|
|
66
|
+
"test": "vitest run"
|
|
67
|
+
}
|
|
6
68
|
}
|