vscode-colaview 0.3.3 → 0.4.1
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/.release-notes-v0.4.1.md +29 -0
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +45 -16
- package/README.md +318 -287
- package/README_CN.md +318 -287
- package/RELEASE_NOTES.md +80 -21
- package/esbuild.js +2 -0
- package/package.json +204 -164
- package/package.nls.json +14 -0
- package/package.nls.zh-cn.json +14 -0
- package/src/commands/commands.ts +48 -0
- package/src/docx/docx-builder.ts +241 -0
- package/src/export/docx-exporter.ts +961 -961
- package/src/export/html-exporter.ts +8 -2
- package/src/export/pdf-exporter.ts +69 -0
- package/src/export/pptx-exporter.ts +63 -0
- package/src/export/render-export-images.ts +386 -386
- package/src/export/theme-style.ts +195 -195
- package/src/pptx/pptx-builder.ts +249 -0
- package/src/pptx/zip.ts +158 -0
- package/src/present/presenter.ts +89 -0
- package/src/preview/preview-manager.ts +783 -541
- package/src/preview/webview/app.ts +695 -370
- package/src/preview/webview/index.html +167 -146
- package/src/slides/deck.ts +408 -0
- package/src/slides/markdown.ts +420 -0
- package/src/slides/render.ts +580 -0
- package/src/slides/slides.css +1082 -0
- package/src/themes/built-in/bear.css +64 -13
- package/src/themes/built-in/dark.css +64 -5
- package/src/themes/built-in/dracula.css +64 -5
- package/src/themes/built-in/elegant.css +75 -11
- package/src/themes/built-in/gruvbox.css +65 -6
- package/src/themes/built-in/light.css +62 -2
- package/src/themes/built-in/midnight.css +64 -6
- package/src/themes/built-in/nord.css +64 -5
- package/src/themes/built-in/notion.css +63 -11
- package/src/themes/built-in/sepia.css +65 -10
- package/src/themes/built-in/solarized-dark.css +64 -5
- package/src/themes/built-in/writer.css +66 -19
- package/src/themes/theme-manager.ts +207 -180
- package/src/types/colamd-renderer.d.ts +47 -47
- package/src/types/pele-lazy.d.ts +21 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// 最小 WordprocessingML 生成器 —— 纯同步、零依赖,产出真正的 `.docx`。
|
|
2
|
+
//
|
|
3
|
+
// 只做「够用」的那一层:Normal / Heading1-4 / Quote / Code / ListParagraph
|
|
4
|
+
// 与 9 级编号定义,表格用内联边框,包体通过 zipStore 以 STORE 方式写出。
|
|
5
|
+
// 单位备忘:Word 用 twip(1/20 磅),字号写半磅(`w:sz` 值为字号×2)。
|
|
6
|
+
|
|
7
|
+
import { zipStore } from '../pptx/zip';
|
|
8
|
+
|
|
9
|
+
/** 文档块模型:由块级 Markdown AST 转来(见 export/docx-exporter.ts)。 */
|
|
10
|
+
export type DocBlock =
|
|
11
|
+
| { kind: 'heading'; level: 1 | 2 | 3 | 4 | 5 | 6; text: string }
|
|
12
|
+
| { kind: 'paragraph'; text: string }
|
|
13
|
+
| { kind: 'list'; ordered: boolean; items: string[] }
|
|
14
|
+
| { kind: 'code'; text: string; lang?: string }
|
|
15
|
+
| { kind: 'quote'; text: string }
|
|
16
|
+
| { kind: 'table'; header: string[]; rows: string[][] }
|
|
17
|
+
| { kind: 'divider' };
|
|
18
|
+
|
|
19
|
+
/** 版式与字体覆盖项;缺省值见下方默认常量。 */
|
|
20
|
+
export interface DocxMeta {
|
|
21
|
+
/** 主色,形如 `#b0401f`;给出时用于标题与引用边线。 */
|
|
22
|
+
accent?: string;
|
|
23
|
+
/** 正文字体,例如 `Source Han Serif SC`。 */
|
|
24
|
+
fontBody?: string;
|
|
25
|
+
/** 等宽字体,例如 `JetBrains Mono`。 */
|
|
26
|
+
fontMono?: string;
|
|
27
|
+
/** 文档标题,写入 core.xml。 */
|
|
28
|
+
title?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const XML_DECL = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
32
|
+
/** 所有 zip 条目共用的固定时间戳,保证同一输入产出同一字节。 */
|
|
33
|
+
const FIXED_DATE = new Date(Date.UTC(2024, 0, 1));
|
|
34
|
+
const DEFAULT_ACCENT = 'B0401F';
|
|
35
|
+
const DEFAULT_FONT_BODY = 'Calibri';
|
|
36
|
+
const DEFAULT_FONT_MONO = 'Consolas';
|
|
37
|
+
/** A4 去掉左右各 1440 twip 页边距后的正文宽度。 */
|
|
38
|
+
const CONTENT_WIDTH_TWIPS = 9026;
|
|
39
|
+
|
|
40
|
+
const W_NS = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
41
|
+
const R_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
|
|
42
|
+
const PKG_REL_NS = 'http://schemas.openxmlformats.org/package/2006/relationships';
|
|
43
|
+
const CT_NS = 'http://schemas.openxmlformats.org/package/2006/content-types';
|
|
44
|
+
|
|
45
|
+
/** 转义 XML 文本/属性,并剔除 XML 1.0 不接受的控制字符。 */
|
|
46
|
+
function esc(value: string): string {
|
|
47
|
+
return value
|
|
48
|
+
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, '')
|
|
49
|
+
.replace(/&/g, '&')
|
|
50
|
+
.replace(/</g, '<')
|
|
51
|
+
.replace(/>/g, '>')
|
|
52
|
+
.replace(/"/g, '"')
|
|
53
|
+
.replace(/'/g, ''');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 把 `#b0401f` / `b0401f` 规范成大写六位 RGB;非法值退回 fallback。 */
|
|
57
|
+
function hex(value: string | undefined, fallback: string): string {
|
|
58
|
+
if (value === undefined) return fallback;
|
|
59
|
+
const raw = value.trim().replace(/^#/, '');
|
|
60
|
+
return /^[0-9a-fA-F]{6}$/.test(raw) ? raw.toUpperCase() : fallback;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 字体名只做去空白与转义,保留调用方给的原名。 */
|
|
64
|
+
function font(value: string | undefined, fallback: string): string {
|
|
65
|
+
const name = (value ?? '').trim();
|
|
66
|
+
return name === '' ? fallback : name;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 把若干「路径 → 文本」条目打包成 zip。 */
|
|
70
|
+
function pack(files: ReadonlyArray<readonly [string, string]>): Uint8Array {
|
|
71
|
+
const encoder = new TextEncoder();
|
|
72
|
+
return zipStore(files.map(([path, text]) => ({ path, data: encoder.encode(text), date: FIXED_DATE })));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 一个 Word 文本 run。 */
|
|
76
|
+
function wRun(text: string, rPr = ''): string {
|
|
77
|
+
return `<w:r>${rPr === '' ? '' : `<w:rPr>${rPr}</w:rPr>`}<w:t xml:space="preserve">${esc(text)}</w:t></w:r>`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 按换行拆成多个 run,行间用 `w:br`(必须是 run 的子元素)。 */
|
|
81
|
+
function wLines(text: string, rPr = ''): string {
|
|
82
|
+
return text
|
|
83
|
+
.replace(/\r\n?/g, '\n')
|
|
84
|
+
.split('\n')
|
|
85
|
+
.map(
|
|
86
|
+
(line, i) =>
|
|
87
|
+
`<w:r>${rPr === '' ? '' : `<w:rPr>${rPr}</w:rPr>`}${i > 0 ? '<w:br/>' : ''}<w:t xml:space="preserve">${esc(line)}</w:t></w:r>`
|
|
88
|
+
)
|
|
89
|
+
.join('');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function wParagraph(inner: string, pPr = ''): string {
|
|
93
|
+
return `<w:p>${pPr === '' ? '' : `<w:pPr>${pPr}</w:pPr>`}${inner}</w:p>`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const wFonts = (name: string): string =>
|
|
97
|
+
`<w:rFonts w:ascii="${esc(name)}" w:hAnsi="${esc(name)}" w:eastAsia="${esc(name)}" w:cs="${esc(name)}"/>`;
|
|
98
|
+
|
|
99
|
+
/** Heading1-4 样式;level 5/6 复用 Heading4。 */
|
|
100
|
+
function headingStyle(level: 1 | 2 | 3 | 4, accent: string | undefined, bodyFont: string): string {
|
|
101
|
+
const sizes = { 1: 40, 2: 32, 3: 28, 4: 24 } as const;
|
|
102
|
+
const before = { 1: 360, 2: 280, 3: 240, 4: 200 } as const;
|
|
103
|
+
const after = { 1: 160, 2: 120, 3: 100, 4: 80 } as const;
|
|
104
|
+
const color = accent === undefined ? '' : `<w:color w:val="${accent}"/>`;
|
|
105
|
+
return `<w:style w:type="paragraph" w:styleId="Heading${level}"><w:name w:val="heading ${level}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="${before[level]}" w:after="${after[level]}"/><w:outlineLvl w:val="${level - 1}"/></w:pPr><w:rPr>${wFonts(bodyFont)}<w:b/><w:bCs/>${color}<w:sz w:val="${sizes[level]}"/><w:szCs w:val="${sizes[level]}"/></w:rPr></w:style>`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** 9 级编号定义:bullet(numId 1)与 decimal(numId 2)。 */
|
|
109
|
+
function numberingXml(): string {
|
|
110
|
+
const levels = (ordered: boolean): string =>
|
|
111
|
+
Array.from({ length: 9 }, (_, lvl) => {
|
|
112
|
+
const indent = 720 + lvl * 360;
|
|
113
|
+
const fmt = ordered ? 'decimal' : 'bullet';
|
|
114
|
+
const text = ordered ? `%${lvl + 1}.` : '•';
|
|
115
|
+
const suff = ordered ? '<w:suff w:val="space"/>' : '';
|
|
116
|
+
return `<w:lvl w:ilvl="${lvl}"><w:start w:val="1"/><w:numFmt w:val="${fmt}"/>${suff}<w:lvlText w:val="${text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${indent}" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:hint="default"/></w:rPr></w:lvl>`;
|
|
117
|
+
}).join('');
|
|
118
|
+
return `${XML_DECL}<w:numbering xmlns:w="${W_NS}"><w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="hybridMultilevel"/>${levels(false)}</w:abstractNum><w:abstractNum w:abstractNumId="1"><w:multiLevelType w:val="hybridMultilevel"/>${levels(true)}</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num><w:num w:numId="2"><w:abstractNumId w:val="1"/></w:num></w:numbering>`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function docxStyles(meta: DocxMeta): string {
|
|
122
|
+
const bodyFont = font(meta.fontBody, DEFAULT_FONT_BODY);
|
|
123
|
+
const monoFont = font(meta.fontMono, DEFAULT_FONT_MONO);
|
|
124
|
+
const accent = meta.accent === undefined ? undefined : hex(meta.accent, DEFAULT_ACCENT);
|
|
125
|
+
const quoteEdge = accent ?? 'BFBFBF';
|
|
126
|
+
return `${XML_DECL}<w:styles xmlns:w="${W_NS}"><w:docDefaults><w:rPrDefault><w:rPr>${wFonts(bodyFont)}<w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="en-US" w:eastAsia="zh-CN"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:before="0" w:after="160" w:line="320" w:lineRule="auto"/></w:pPr><w:rPr>${wFonts(bodyFont)}<w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style>${headingStyle(1, accent, bodyFont)}${headingStyle(2, accent, bodyFont)}${headingStyle(3, accent, bodyFont)}${headingStyle(4, accent, bodyFont)}<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:pBdr><w:left w:val="single" w:sz="18" w:space="8" w:color="${quoteEdge}"/></w:pBdr><w:spacing w:before="80" w:after="160"/><w:ind w:left="360" w:right="180"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="595959"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:shd w:val="clear" w:color="auto" w:fill="F5F3EF"/><w:spacing w:before="0" w:after="0" w:line="240" w:lineRule="auto"/><w:ind w:left="120" w:right="120"/></w:pPr><w:rPr>${wFonts(monoFont)}<w:sz w:val="19"/><w:szCs w:val="19"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:before="0" w:after="80"/><w:ind w:left="720" w:hanging="360"/></w:pPr></w:style></w:styles>`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** 单元格宽度按列数均分;表头行重复、加粗、浅灰底。 */
|
|
130
|
+
function tableXml(header: readonly string[], rows: readonly string[][]): string {
|
|
131
|
+
let cols = header.length;
|
|
132
|
+
for (const row of rows) cols = Math.max(cols, row.length);
|
|
133
|
+
if (cols === 0) return '';
|
|
134
|
+
const width = Math.floor(CONTENT_WIDTH_TWIPS / cols);
|
|
135
|
+
const grid = `<w:tblGrid>${`<w:gridCol w:w="${width}"/>`.repeat(cols)}</w:tblGrid>`;
|
|
136
|
+
const cell = (text: string, isHeader: boolean): string =>
|
|
137
|
+
`<w:tc><w:tcPr><w:tcW w:w="${width}" w:type="dxa"/>${isHeader ? '<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2"/>' : ''}</w:tcPr>${wParagraph(wRun(text, isHeader ? '<w:b/><w:bCs/>' : ''), '<w:spacing w:before="0" w:after="0" w:line="240" w:lineRule="auto"/>')}</w:tc>`;
|
|
138
|
+
const row = (cells: readonly string[], isHeader: boolean): string =>
|
|
139
|
+
`<w:tr>${isHeader ? '<w:trPr><w:tblHeader/></w:trPr>' : ''}${cells.map((text) => cell(text, isHeader)).join('')}</w:tr>`;
|
|
140
|
+
const headerRow = header.length === 0 ? '' : row(header, true);
|
|
141
|
+
const bodyRows = rows
|
|
142
|
+
.map((cells) => {
|
|
143
|
+
const padded = Array.from({ length: cols }, (_, i) => cells[i] ?? '');
|
|
144
|
+
return row(padded, false);
|
|
145
|
+
})
|
|
146
|
+
.join('');
|
|
147
|
+
return `<w:tbl><w:tblPr><w:tblW w:w="0" w:type="auto"/><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/><w:left w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/><w:right w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/></w:tblBorders><w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/></w:tblPr>${grid}${headerRow}${bodyRows}</w:tbl>`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function docxDocument(blocks: readonly DocBlock[]): string {
|
|
151
|
+
const body: string[] = [];
|
|
152
|
+
let lastWasTable = false;
|
|
153
|
+
for (const block of blocks) {
|
|
154
|
+
if (block.kind !== 'table') lastWasTable = false;
|
|
155
|
+
switch (block.kind) {
|
|
156
|
+
case 'heading': {
|
|
157
|
+
const level = Math.min(block.level, 4);
|
|
158
|
+
body.push(wParagraph(wLines(block.text), `<w:pStyle w:val="Heading${level}"/>`));
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case 'paragraph': {
|
|
162
|
+
if (block.text.trim() === '') break;
|
|
163
|
+
body.push(wParagraph(wLines(block.text)));
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case 'list': {
|
|
167
|
+
const numId = block.ordered ? 2 : 1;
|
|
168
|
+
for (const item of block.items) {
|
|
169
|
+
if (item.trim() === '') continue;
|
|
170
|
+
body.push(
|
|
171
|
+
wParagraph(
|
|
172
|
+
wLines(item),
|
|
173
|
+
`<w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="0"/><w:numId w:val="${numId}"/></w:numPr>`
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
case 'code': {
|
|
180
|
+
body.push(wParagraph(wLines(block.text), '<w:pStyle w:val="Code"/>'));
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case 'quote': {
|
|
184
|
+
if (block.text.trim() === '') break;
|
|
185
|
+
body.push(wParagraph(wLines(block.text), '<w:pStyle w:val="Quote"/>'));
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case 'table': {
|
|
189
|
+
const table = tableXml(block.header, block.rows);
|
|
190
|
+
if (table !== '') {
|
|
191
|
+
body.push(table);
|
|
192
|
+
lastWasTable = true;
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case 'divider': {
|
|
197
|
+
body.push(
|
|
198
|
+
'<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="BFBFBF"/></w:pBdr><w:spacing w:before="120" w:after="120"/></w:pPr></w:p>'
|
|
199
|
+
);
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (lastWasTable) body.push('<w:p/>'); // Word 不希望 body 直接以表格收尾
|
|
205
|
+
const sectPr =
|
|
206
|
+
'<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:linePitch="312"/></w:sectPr>';
|
|
207
|
+
return `${XML_DECL}<w:document xmlns:w="${W_NS}" xmlns:r="${R_NS}"><w:body>${body.join('')}${sectPr}</w:body></w:document>`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function coreXml(title: string): string {
|
|
211
|
+
return `${XML_DECL}<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>${esc(title)}</dc:title><dc:creator>ColaView MD</dc:creator><cp:lastModifiedBy>ColaView MD</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">2024-01-01T00:00:00Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2024-01-01T00:00:00Z</dcterms:modified></cp:coreProperties>`;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function appXml(): string {
|
|
215
|
+
return `${XML_DECL}<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>ColaView MD</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0000</AppVersion></Properties>`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* 生成一份 Word 文档。
|
|
220
|
+
*
|
|
221
|
+
* 标题样式为内置 Heading1-4,`level` 5/6 复用 Heading4;列表依赖
|
|
222
|
+
* numbering.xml 里的 numId 1(圆点)与 2(十进制);表格使用内联边框,
|
|
223
|
+
* 不依赖 TableGrid 样式。
|
|
224
|
+
*/
|
|
225
|
+
export function buildDocx(input: { blocks: DocBlock[]; meta?: DocxMeta }): Uint8Array {
|
|
226
|
+
const meta = input.meta ?? {};
|
|
227
|
+
const title = meta.title ?? 'ColaView Document';
|
|
228
|
+
const contentTypes = `${XML_DECL}<Types xmlns="${CT_NS}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>`;
|
|
229
|
+
const rootRels = `${XML_DECL}<Relationships xmlns="${PKG_REL_NS}"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>`;
|
|
230
|
+
const documentRels = `${XML_DECL}<Relationships xmlns="${PKG_REL_NS}"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/></Relationships>`;
|
|
231
|
+
return pack([
|
|
232
|
+
['[Content_Types].xml', contentTypes],
|
|
233
|
+
['_rels/.rels', rootRels],
|
|
234
|
+
['docProps/core.xml', coreXml(title)],
|
|
235
|
+
['docProps/app.xml', appXml()],
|
|
236
|
+
['word/document.xml', docxDocument(input.blocks)],
|
|
237
|
+
['word/_rels/document.xml.rels', documentRels],
|
|
238
|
+
['word/styles.xml', docxStyles(meta)],
|
|
239
|
+
['word/numbering.xml', numberingXml()],
|
|
240
|
+
]);
|
|
241
|
+
}
|