docrev 0.11.2 → 0.12.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.
Files changed (205) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +21 -0
  3. package/dist/bin/rev.js +29 -21
  4. package/dist/bin/rev.js.map +1 -1
  5. package/dist/lib/annotations.d.ts.map +1 -1
  6. package/dist/lib/annotations.js +28 -0
  7. package/dist/lib/annotations.js.map +1 -1
  8. package/dist/lib/build.d.ts +43 -0
  9. package/dist/lib/build.d.ts.map +1 -1
  10. package/dist/lib/build.js +175 -5
  11. package/dist/lib/build.js.map +1 -1
  12. package/dist/lib/commands/build.d.ts.map +1 -1
  13. package/dist/lib/commands/build.js +39 -125
  14. package/dist/lib/commands/build.js.map +1 -1
  15. package/dist/lib/commands/comments.d.ts.map +1 -1
  16. package/dist/lib/commands/comments.js +61 -31
  17. package/dist/lib/commands/comments.js.map +1 -1
  18. package/dist/lib/commands/context.d.ts +12 -0
  19. package/dist/lib/commands/context.d.ts.map +1 -1
  20. package/dist/lib/commands/context.js +34 -0
  21. package/dist/lib/commands/context.js.map +1 -1
  22. package/dist/lib/commands/core.d.ts.map +1 -1
  23. package/dist/lib/commands/core.js +25 -8
  24. package/dist/lib/commands/core.js.map +1 -1
  25. package/dist/lib/commands/merge-resolve.js +1 -1
  26. package/dist/lib/commands/merge-resolve.js.map +1 -1
  27. package/dist/lib/commands/quality.js +2 -2
  28. package/dist/lib/commands/quality.js.map +1 -1
  29. package/dist/lib/commands/response.js +1 -1
  30. package/dist/lib/commands/response.js.map +1 -1
  31. package/dist/lib/commands/sections.js +1 -1
  32. package/dist/lib/commands/sections.js.map +1 -1
  33. package/dist/lib/commands/text-ops.js +1 -1
  34. package/dist/lib/commands/text-ops.js.map +1 -1
  35. package/dist/lib/commands/utilities.d.ts.map +1 -1
  36. package/dist/lib/commands/utilities.js +5 -2
  37. package/dist/lib/commands/utilities.js.map +1 -1
  38. package/dist/lib/commands/word-tools.js +2 -2
  39. package/dist/lib/commands/word-tools.js.map +1 -1
  40. package/dist/lib/crossref.d.ts.map +1 -1
  41. package/dist/lib/crossref.js +12 -41
  42. package/dist/lib/crossref.js.map +1 -1
  43. package/dist/lib/csl.d.ts.map +1 -1
  44. package/dist/lib/csl.js +14 -22
  45. package/dist/lib/csl.js.map +1 -1
  46. package/dist/lib/diff-engine.js +1 -1
  47. package/dist/lib/diff-engine.js.map +1 -1
  48. package/dist/lib/equations.d.ts.map +1 -1
  49. package/dist/lib/equations.js +12 -3
  50. package/dist/lib/equations.js.map +1 -1
  51. package/dist/lib/errors.d.ts.map +1 -1
  52. package/dist/lib/errors.js +1 -30
  53. package/dist/lib/errors.js.map +1 -1
  54. package/dist/lib/image-registry.d.ts.map +1 -1
  55. package/dist/lib/image-registry.js +4 -0
  56. package/dist/lib/image-registry.js.map +1 -1
  57. package/dist/lib/import.d.ts +15 -1
  58. package/dist/lib/import.d.ts.map +1 -1
  59. package/dist/lib/import.js +24 -1
  60. package/dist/lib/import.js.map +1 -1
  61. package/dist/lib/input.d.ts +56 -0
  62. package/dist/lib/input.d.ts.map +1 -0
  63. package/dist/lib/input.js +129 -0
  64. package/dist/lib/input.js.map +1 -0
  65. package/dist/lib/merge.d.ts.map +1 -1
  66. package/dist/lib/merge.js +9 -1
  67. package/dist/lib/merge.js.map +1 -1
  68. package/dist/lib/ooxml.d.ts +22 -0
  69. package/dist/lib/ooxml.d.ts.map +1 -1
  70. package/dist/lib/ooxml.js +130 -0
  71. package/dist/lib/ooxml.js.map +1 -1
  72. package/dist/lib/orcid.d.ts.map +1 -1
  73. package/dist/lib/orcid.js +16 -7
  74. package/dist/lib/orcid.js.map +1 -1
  75. package/dist/lib/plugins.d.ts.map +1 -1
  76. package/dist/lib/plugins.js +8 -4
  77. package/dist/lib/plugins.js.map +1 -1
  78. package/dist/lib/protect-restore.d.ts.map +1 -1
  79. package/dist/lib/protect-restore.js +7 -5
  80. package/dist/lib/protect-restore.js.map +1 -1
  81. package/dist/lib/response.d.ts +1 -1
  82. package/dist/lib/response.d.ts.map +1 -1
  83. package/dist/lib/response.js +5 -2
  84. package/dist/lib/response.js.map +1 -1
  85. package/dist/lib/restore-references.d.ts.map +1 -1
  86. package/dist/lib/restore-references.js +25 -3
  87. package/dist/lib/restore-references.js.map +1 -1
  88. package/dist/lib/schema.d.ts.map +1 -1
  89. package/dist/lib/schema.js +1 -19
  90. package/dist/lib/schema.js.map +1 -1
  91. package/dist/lib/slides.js +1 -1
  92. package/dist/lib/slides.js.map +1 -1
  93. package/dist/lib/spelling.js +1 -1
  94. package/dist/lib/spelling.js.map +1 -1
  95. package/dist/lib/tui.js +0 -1
  96. package/dist/lib/tui.js.map +1 -1
  97. package/dist/lib/utils.d.ts +14 -0
  98. package/dist/lib/utils.d.ts.map +1 -1
  99. package/dist/lib/utils.js +41 -0
  100. package/dist/lib/utils.js.map +1 -1
  101. package/dist/lib/word-extraction.d.ts +5 -5
  102. package/dist/lib/word-extraction.d.ts.map +1 -1
  103. package/dist/lib/word-extraction.js +25 -106
  104. package/dist/lib/word-extraction.js.map +1 -1
  105. package/dist/lib/word.d.ts +14 -38
  106. package/dist/lib/word.d.ts.map +1 -1
  107. package/dist/lib/word.js +24 -179
  108. package/dist/lib/word.js.map +1 -1
  109. package/dist/lib/wordcomments.d.ts.map +1 -1
  110. package/dist/lib/wordcomments.js +9 -7
  111. package/dist/lib/wordcomments.js.map +1 -1
  112. package/package.json +17 -6
  113. package/.gitattributes +0 -1
  114. package/PLAN-tables-and-postprocess.md +0 -850
  115. package/bin/rev.ts +0 -145
  116. package/docs-src/build.py +0 -113
  117. package/docs-src/extra.css +0 -208
  118. package/docs-src/md-to-html.lua +0 -6
  119. package/docs-src/template.html +0 -116
  120. package/eslint.config.js +0 -27
  121. package/lib/anchor-match.ts +0 -307
  122. package/lib/annotations.ts +0 -664
  123. package/lib/build.ts +0 -2047
  124. package/lib/citations.ts +0 -160
  125. package/lib/commands/build.ts +0 -885
  126. package/lib/commands/citations.ts +0 -515
  127. package/lib/commands/comments.ts +0 -1050
  128. package/lib/commands/context.ts +0 -176
  129. package/lib/commands/core.ts +0 -309
  130. package/lib/commands/doi.ts +0 -451
  131. package/lib/commands/file-ops.ts +0 -372
  132. package/lib/commands/history.ts +0 -320
  133. package/lib/commands/index.ts +0 -87
  134. package/lib/commands/init.ts +0 -259
  135. package/lib/commands/merge-resolve.ts +0 -378
  136. package/lib/commands/preview.ts +0 -178
  137. package/lib/commands/project-info.ts +0 -244
  138. package/lib/commands/quality.ts +0 -517
  139. package/lib/commands/response.ts +0 -454
  140. package/lib/commands/section-boundaries.ts +0 -82
  141. package/lib/commands/sections.ts +0 -451
  142. package/lib/commands/sync.ts +0 -689
  143. package/lib/commands/text-ops.ts +0 -449
  144. package/lib/commands/utilities.ts +0 -448
  145. package/lib/commands/verify-anchors.ts +0 -272
  146. package/lib/commands/word-tools.ts +0 -340
  147. package/lib/comment-realign.ts +0 -99
  148. package/lib/config.ts +0 -84
  149. package/lib/crossref.ts +0 -781
  150. package/lib/csl.ts +0 -191
  151. package/lib/dependencies.ts +0 -132
  152. package/lib/diff-engine.ts +0 -465
  153. package/lib/doi-cache.ts +0 -115
  154. package/lib/doi.ts +0 -879
  155. package/lib/equations.ts +0 -506
  156. package/lib/errors.ts +0 -350
  157. package/lib/format.ts +0 -541
  158. package/lib/git.ts +0 -326
  159. package/lib/grammar.ts +0 -303
  160. package/lib/image-registry.ts +0 -180
  161. package/lib/import.ts +0 -906
  162. package/lib/journals.ts +0 -543
  163. package/lib/macro-filter.lua +0 -201
  164. package/lib/macros.ts +0 -273
  165. package/lib/merge.ts +0 -633
  166. package/lib/ooxml.ts +0 -768
  167. package/lib/orcid.ts +0 -144
  168. package/lib/pdf-comments.ts +0 -263
  169. package/lib/pdf-import.ts +0 -524
  170. package/lib/plugins.ts +0 -362
  171. package/lib/postprocess.ts +0 -188
  172. package/lib/pptx-color-filter.lua +0 -37
  173. package/lib/pptx-template.ts +0 -469
  174. package/lib/pptx-themes/academic.pptx +0 -0
  175. package/lib/pptx-themes/corporate.pptx +0 -0
  176. package/lib/pptx-themes/dark.pptx +0 -0
  177. package/lib/pptx-themes/default.pptx +0 -0
  178. package/lib/pptx-themes/minimal.pptx +0 -0
  179. package/lib/pptx-themes/plant.pptx +0 -0
  180. package/lib/pptx-themes.ts +0 -483
  181. package/lib/protect-restore.ts +0 -520
  182. package/lib/rate-limiter.ts +0 -127
  183. package/lib/response.ts +0 -197
  184. package/lib/restore-references.ts +0 -240
  185. package/lib/review.ts +0 -327
  186. package/lib/schema.ts +0 -494
  187. package/lib/scientific-words.ts +0 -73
  188. package/lib/sections.ts +0 -428
  189. package/lib/slides.ts +0 -756
  190. package/lib/spelling.ts +0 -334
  191. package/lib/templates.ts +0 -526
  192. package/lib/themes.ts +0 -742
  193. package/lib/trackchanges.ts +0 -166
  194. package/lib/tui.ts +0 -450
  195. package/lib/types.ts +0 -546
  196. package/lib/undo.ts +0 -250
  197. package/lib/utils.ts +0 -69
  198. package/lib/variables.ts +0 -179
  199. package/lib/word-extraction.ts +0 -525
  200. package/lib/word.ts +0 -526
  201. package/lib/wordcomments.ts +0 -789
  202. package/mkdocs.yml +0 -64
  203. package/scripts/postbuild.js +0 -47
  204. package/tsconfig.json +0 -26
  205. package/types/index.d.ts +0 -531
@@ -1,483 +0,0 @@
1
- /**
2
- * PPTX Theme System
3
- *
4
- * Provides 6 built-in themes for PPTX output, independent of Beamer themes.
5
- * Each theme is a reference PPTX file that defines colors, fonts, and slide layouts.
6
- *
7
- * Uses pandoc's default reference.pptx as the base template and modifies the theme.xml
8
- * to apply custom colors and fonts. This ensures all 11 required slide layouts are present.
9
- *
10
- * Themes:
11
- * - default: Clean white with blue accents (professional)
12
- * - dark: Dark background with light text (modern)
13
- * - academic: Classic serif fonts, muted colors (scholarly)
14
- * - minimal: High contrast black/white (clean)
15
- * - corporate: Navy/gold color scheme (business)
16
- * - plant: Nature-inspired green theme (ecology/biology)
17
- */
18
-
19
- import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
20
- import { join, dirname } from 'node:path';
21
- import { fileURLToPath } from 'node:url';
22
- import { execSync } from 'node:child_process';
23
- import AdmZip from 'adm-zip';
24
-
25
- const __dirname = dirname(fileURLToPath(import.meta.url));
26
-
27
- /**
28
- * Color scheme for a theme
29
- */
30
- interface ThemeColors {
31
- dk1: string;
32
- lt1: string;
33
- dk2: string;
34
- lt2: string;
35
- accent1: string;
36
- accent2: string;
37
- accent3: string;
38
- accent4: string;
39
- accent5: string;
40
- accent6: string;
41
- hlink: string;
42
- folHlink: string;
43
- }
44
-
45
- /**
46
- * Font scheme for a theme
47
- */
48
- interface ThemeFonts {
49
- major: string;
50
- minor: string;
51
- }
52
-
53
- /**
54
- * PPTX theme definition
55
- */
56
- interface PptxTheme {
57
- name: string;
58
- description: string;
59
- colors: ThemeColors;
60
- fonts: ThemeFonts;
61
- background?: string;
62
- }
63
-
64
- /**
65
- * Theme definitions with colors and fonts
66
- */
67
- export const PPTX_THEMES: Record<string, PptxTheme> = {
68
- default: {
69
- name: 'Default',
70
- description: 'Clean white with blue accents',
71
- colors: {
72
- dk1: '000000', // Dark text
73
- lt1: 'FFFFFF', // Light background
74
- dk2: '1F497D', // Dark accent (navy)
75
- lt2: 'EEECE1', // Light accent (cream)
76
- accent1: '4472C4', // Blue
77
- accent2: 'ED7D31', // Orange
78
- accent3: 'A5A5A5', // Gray
79
- accent4: 'FFC000', // Yellow
80
- accent5: '5B9BD5', // Light blue
81
- accent6: '70AD47', // Green
82
- hlink: '0563C1', // Hyperlink blue
83
- folHlink: '954F72', // Followed hyperlink
84
- },
85
- fonts: {
86
- major: 'Calibri Light',
87
- minor: 'Calibri',
88
- },
89
- },
90
- dark: {
91
- name: 'Dark',
92
- description: 'Dark background with light text',
93
- colors: {
94
- dk1: 'FFFFFF', // Light text (inverted)
95
- lt1: '1E1E1E', // Dark background
96
- dk2: 'E0E0E0', // Light gray
97
- lt2: '2D2D2D', // Darker gray
98
- accent1: '00B4D8', // Cyan
99
- accent2: 'FF6B6B', // Coral
100
- accent3: '95E1D3', // Mint
101
- accent4: 'F38181', // Pink
102
- accent5: 'AA96DA', // Lavender
103
- accent6: 'FCBAD3', // Light pink
104
- hlink: '00B4D8',
105
- folHlink: 'AA96DA',
106
- },
107
- fonts: {
108
- major: 'Inter',
109
- minor: 'Inter',
110
- },
111
- background: '1E1E1E',
112
- },
113
- academic: {
114
- name: 'Academic',
115
- description: 'Classic serif fonts, muted colors',
116
- colors: {
117
- dk1: '2C3E50', // Dark blue-gray
118
- lt1: 'FFFEF9', // Warm white
119
- dk2: '34495E', // Slate
120
- lt2: 'F5F5DC', // Beige
121
- accent1: '8B4513', // Saddle brown
122
- accent2: '2E8B57', // Sea green
123
- accent3: '708090', // Slate gray
124
- accent4: 'B8860B', // Dark goldenrod
125
- accent5: '4682B4', // Steel blue
126
- accent6: '6B8E23', // Olive drab
127
- hlink: '8B4513',
128
- folHlink: '708090',
129
- },
130
- fonts: {
131
- major: 'Georgia',
132
- minor: 'Palatino Linotype',
133
- },
134
- },
135
- minimal: {
136
- name: 'Minimal',
137
- description: 'High contrast black and white',
138
- colors: {
139
- dk1: '000000', // Pure black
140
- lt1: 'FFFFFF', // Pure white
141
- dk2: '333333', // Dark gray
142
- lt2: 'F0F0F0', // Light gray
143
- accent1: '000000', // Black accent
144
- accent2: '666666', // Medium gray
145
- accent3: '999999', // Light gray
146
- accent4: 'CCCCCC', // Lighter gray
147
- accent5: '333333', // Dark gray
148
- accent6: '4D4D4D', // Charcoal
149
- hlink: '000000',
150
- folHlink: '666666',
151
- },
152
- fonts: {
153
- major: 'Roboto Light',
154
- minor: 'Roboto',
155
- },
156
- },
157
- corporate: {
158
- name: 'Corporate',
159
- description: 'Navy and gold professional theme',
160
- colors: {
161
- dk1: '0D1B2A', // Very dark navy
162
- lt1: 'FFFFFF', // White
163
- dk2: '1B263B', // Dark navy
164
- lt2: 'E0E1DD', // Light gray
165
- accent1: 'D4AF37', // Gold
166
- accent2: '415A77', // Steel blue
167
- accent3: '778DA9', // Light steel
168
- accent4: 'C5A900', // Darker gold
169
- accent5: '1B4965', // Deep blue
170
- accent6: '5FA8D3', // Sky blue
171
- hlink: 'D4AF37',
172
- folHlink: '778DA9',
173
- },
174
- fonts: {
175
- major: 'Garamond',
176
- minor: 'Garamond',
177
- },
178
- },
179
- plant: {
180
- name: 'Plant',
181
- description: 'Nature-inspired green theme for ecology/biology',
182
- colors: {
183
- dk1: '2D4A22', // Dark forest green
184
- lt1: 'FFFFFF', // White
185
- dk2: '3D5A2E', // Medium forest
186
- lt2: 'F5F7F2', // Light sage
187
- accent1: '608C32', // Primary green (theme accent)
188
- accent2: '8B4513', // Earth brown
189
- accent3: '888888', // Gray (for buildup)
190
- accent4: '7CB342', // Light green
191
- accent5: '4A6B3A', // Olive green
192
- accent6: 'A5D6A7', // Pale green
193
- hlink: '608C32',
194
- folHlink: '4A6B3A',
195
- },
196
- fonts: {
197
- major: 'Aptos Display',
198
- minor: 'Aptos',
199
- },
200
- },
201
- };
202
-
203
- /**
204
- * Get list of available theme names
205
- */
206
- export function getThemeNames(): string[] {
207
- return Object.keys(PPTX_THEMES);
208
- }
209
-
210
- /**
211
- * Get theme definition by name
212
- */
213
- export function getTheme(name: string): PptxTheme | null {
214
- return PPTX_THEMES[name] || null;
215
- }
216
-
217
- /**
218
- * Generate [Content_Types].xml
219
- */
220
- function generateContentTypes(): string {
221
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
222
- <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
223
- <Default Extension="jpeg" ContentType="image/jpeg"/>
224
- <Default Extension="png" ContentType="image/png"/>
225
- <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
226
- <Default Extension="xml" ContentType="application/xml"/>
227
- <Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>
228
- <Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>
229
- <Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
230
- <Override PartName="/ppt/slideLayouts/slideLayout2.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
231
- <Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
232
- <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
233
- <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
234
- </Types>`;
235
- }
236
-
237
- /**
238
- * Generate _rels/.rels
239
- */
240
- function generateRels(): string {
241
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
242
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
243
- <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>
244
- <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
245
- <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
246
- </Relationships>`;
247
- }
248
-
249
- /**
250
- * Generate ppt/_rels/presentation.xml.rels
251
- */
252
- function generatePresentationRels(): string {
253
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
254
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
255
- <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>
256
- <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
257
- </Relationships>`;
258
- }
259
-
260
- /**
261
- * Generate ppt/presentation.xml
262
- */
263
- function generatePresentation(): string {
264
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
265
- <p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" saveSubsetFonts="1">
266
- <p:sldMasterIdLst>
267
- <p:sldMasterId id="2147483648" r:id="rId1"/>
268
- </p:sldMasterIdLst>
269
- <p:sldSz cx="12192000" cy="6858000"/>
270
- <p:notesSz cx="6858000" cy="9144000"/>
271
- <p:defaultTextStyle>
272
- <a:defPPr>
273
- <a:defRPr lang="en-US"/>
274
- </a:defPPr>
275
- </p:defaultTextStyle>
276
- </p:presentation>`;
277
- }
278
-
279
- /**
280
- * Generate ppt/theme/theme1.xml with theme colors and fonts
281
- */
282
- function generateTheme(theme: PptxTheme): string {
283
- const c = theme.colors;
284
- const f = theme.fonts;
285
-
286
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
287
- <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${theme.name}">
288
- <a:themeElements>
289
- <a:clrScheme name="${theme.name}">
290
- <a:dk1><a:srgbClr val="${c.dk1}"/></a:dk1>
291
- <a:lt1><a:srgbClr val="${c.lt1}"/></a:lt1>
292
- <a:dk2><a:srgbClr val="${c.dk2}"/></a:dk2>
293
- <a:lt2><a:srgbClr val="${c.lt2}"/></a:lt2>
294
- <a:accent1><a:srgbClr val="${c.accent1}"/></a:accent1>
295
- <a:accent2><a:srgbClr val="${c.accent2}"/></a:accent2>
296
- <a:accent3><a:srgbClr val="${c.accent3}"/></a:accent3>
297
- <a:accent4><a:srgbClr val="${c.accent4}"/></a:accent4>
298
- <a:accent5><a:srgbClr val="${c.accent5}"/></a:accent5>
299
- <a:accent6><a:srgbClr val="${c.accent6}"/></a:accent6>
300
- <a:hlink><a:srgbClr val="${c.hlink}"/></a:hlink>
301
- <a:folHlink><a:srgbClr val="${c.folHlink}"/></a:folHlink>
302
- </a:clrScheme>
303
- <a:fontScheme name="${theme.name}">
304
- <a:majorFont>
305
- <a:latin typeface="${f.major}"/>
306
- <a:ea typeface=""/>
307
- <a:cs typeface=""/>
308
- </a:majorFont>
309
- <a:minorFont>
310
- <a:latin typeface="${f.minor}"/>
311
- <a:ea typeface=""/>
312
- <a:cs typeface=""/>
313
- </a:minorFont>
314
- </a:fontScheme>
315
- <a:fmtScheme name="${theme.name}">
316
- <a:fillStyleLst>
317
- <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>
318
- <a:gradFill rotWithShape="1">
319
- <a:gsLst>
320
- <a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>
321
- <a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>
322
- <a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>
323
- </a:gsLst>
324
- <a:lin ang="16200000" scaled="1"/>
325
- </a:gradFill>
326
- <a:gradFill rotWithShape="1">
327
- <a:gsLst>
328
- <a:gs pos="0"><a:schemeClr val="phClr"><a:shade val="51000"/><a:satMod val="130000"/></a:schemeClr></a:gs>
329
- <a:gs pos="80000"><a:schemeClr val="phClr"><a:shade val="93000"/><a:satMod val="130000"/></a:schemeClr></a:gs>
330
- <a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="94000"/><a:satMod val="135000"/></a:schemeClr></a:gs>
331
- </a:gsLst>
332
- <a:lin ang="16200000" scaled="0"/>
333
- </a:gradFill>
334
- </a:fillStyleLst>
335
- <a:lnStyleLst>
336
- <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>
337
- <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>
338
- <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>
339
- </a:lnStyleLst>
340
- <a:effectStyleLst>
341
- <a:effectStyle><a:effectLst/></a:effectStyle>
342
- <a:effectStyle><a:effectLst/></a:effectStyle>
343
- <a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle>
344
- </a:effectStyleLst>
345
- <a:bgFillStyleLst>
346
- <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>
347
- <a:gradFill rotWithShape="1">
348
- <a:gsLst>
349
- <a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>
350
- <a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>
351
- <a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>
352
- </a:gsLst>
353
- <a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>
354
- </a:gradFill>
355
- <a:gradFill rotWithShape="1">
356
- <a:gsLst>
357
- <a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>
358
- <a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>
359
- </a:gsLst>
360
- <a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>
361
- </a:gradFill>
362
- </a:bgFillStyleLst>
363
- </a:fmtScheme>
364
- </a:themeElements>
365
- <a:objectDefaults/>
366
- <a:extraClrSchemeLst/>
367
- </a:theme>`;
368
- }
369
-
370
- /**
371
- * Get pandoc's default reference.pptx as a base template
372
- */
373
- function getPandocReferenceTemplate(): Buffer {
374
- try {
375
- // Use pandoc to extract the default reference template
376
- const result = execSync('pandoc --print-default-data-file reference.pptx', {
377
- encoding: 'buffer',
378
- maxBuffer: 1024 * 1024, // 1MB should be plenty
379
- });
380
- return result;
381
- } catch (err: unknown) {
382
- const message = err instanceof Error ? err.message : String(err);
383
- throw new Error(`Failed to get pandoc reference template: ${message}`);
384
- }
385
- }
386
-
387
- /**
388
- * Generate a PPTX theme file by modifying pandoc's reference template
389
- */
390
- export function generateThemeFile(themeName: string, outputPath: string): string {
391
- const theme = PPTX_THEMES[themeName];
392
- if (!theme) {
393
- throw new Error(`Unknown theme: ${themeName}`);
394
- }
395
-
396
- // Get pandoc's reference template as base
397
- const templateBuffer = getPandocReferenceTemplate();
398
- const zip = new AdmZip(templateBuffer);
399
-
400
- // Replace theme.xml with our custom theme
401
- zip.updateFile('ppt/theme/theme1.xml', Buffer.from(generateTheme(theme), 'utf-8'));
402
-
403
- // For dark themes, update slide masters and layouts with background color
404
- if (theme.background) {
405
- updateBackgroundColor(zip, theme.background);
406
- }
407
-
408
- // Ensure output directory exists
409
- const dir = dirname(outputPath);
410
- if (!existsSync(dir)) {
411
- mkdirSync(dir, { recursive: true });
412
- }
413
-
414
- zip.writeZip(outputPath);
415
- return outputPath;
416
- }
417
-
418
- /**
419
- * Update background color in slide masters and layouts for dark themes
420
- */
421
- function updateBackgroundColor(zip: AdmZip, bgColor: string): void {
422
- const entries = zip.getEntries();
423
-
424
- for (const entry of entries) {
425
- const name = entry.entryName;
426
-
427
- // Update slide masters and layouts
428
- if (name.includes('slideMasters/') || name.includes('slideLayouts/')) {
429
- if (name.endsWith('.xml') && !name.includes('_rels')) {
430
- let content = entry.getData().toString('utf-8');
431
-
432
- // Replace light background with dark background
433
- // Look for <a:schemeClr val="lt1"/> in bgPr and replace
434
- content = content.replace(
435
- /<p:bg>[\s\S]*?<\/p:bg>/g,
436
- `<p:bg><p:bgPr><a:solidFill><a:srgbClr val="${bgColor}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>`
437
- );
438
-
439
- zip.updateFile(name, Buffer.from(content, 'utf-8'));
440
- }
441
- }
442
- }
443
- }
444
-
445
- /**
446
- * Get path to bundled theme file, generating if needed
447
- */
448
- export function getThemePath(themeName: string): string | null {
449
- if (!PPTX_THEMES[themeName]) {
450
- return null;
451
- }
452
-
453
- const themesDir = join(__dirname, 'pptx-themes');
454
- const themePath = join(themesDir, `${themeName}.pptx`);
455
-
456
- // Generate if doesn't exist
457
- if (!existsSync(themePath)) {
458
- if (!existsSync(themesDir)) {
459
- mkdirSync(themesDir, { recursive: true });
460
- }
461
- generateThemeFile(themeName, themePath);
462
- }
463
-
464
- return themePath;
465
- }
466
-
467
- /**
468
- * Generate all theme files
469
- */
470
- export function generateAllThemes(outputDir: string): Array<{ theme: string; path: string }> {
471
- if (!existsSync(outputDir)) {
472
- mkdirSync(outputDir, { recursive: true });
473
- }
474
-
475
- const results = [];
476
- for (const themeName of Object.keys(PPTX_THEMES)) {
477
- const outputPath = join(outputDir, `${themeName}.pptx`);
478
- generateThemeFile(themeName, outputPath);
479
- results.push({ theme: themeName, path: outputPath });
480
- }
481
-
482
- return results;
483
- }