docrev 0.8.1 → 0.9.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/.claude/settings.local.json +9 -0
- package/.gitattributes +1 -0
- package/PLAN-tables-and-postprocess.md +850 -0
- package/README.md +33 -0
- package/bin/rev.js +12 -131
- package/bin/rev.ts +145 -0
- package/dist/bin/rev.d.ts +9 -0
- package/dist/bin/rev.d.ts.map +1 -0
- package/dist/bin/rev.js +118 -0
- package/dist/bin/rev.js.map +1 -0
- package/dist/lib/annotations.d.ts +91 -0
- package/dist/lib/annotations.d.ts.map +1 -0
- package/dist/lib/annotations.js +554 -0
- package/dist/lib/annotations.js.map +1 -0
- package/dist/lib/build.d.ts +171 -0
- package/dist/lib/build.d.ts.map +1 -0
- package/dist/lib/build.js +755 -0
- package/dist/lib/build.js.map +1 -0
- package/dist/lib/citations.d.ts +34 -0
- package/dist/lib/citations.d.ts.map +1 -0
- package/dist/lib/citations.js +140 -0
- package/dist/lib/citations.js.map +1 -0
- package/dist/lib/commands/build.d.ts +13 -0
- package/dist/lib/commands/build.d.ts.map +1 -0
- package/dist/lib/commands/build.js +678 -0
- package/dist/lib/commands/build.js.map +1 -0
- package/dist/lib/commands/citations.d.ts +11 -0
- package/dist/lib/commands/citations.d.ts.map +1 -0
- package/dist/lib/commands/citations.js +428 -0
- package/dist/lib/commands/citations.js.map +1 -0
- package/dist/lib/commands/comments.d.ts +11 -0
- package/dist/lib/commands/comments.d.ts.map +1 -0
- package/dist/lib/commands/comments.js +883 -0
- package/dist/lib/commands/comments.js.map +1 -0
- package/dist/lib/commands/context.d.ts +35 -0
- package/dist/lib/commands/context.d.ts.map +1 -0
- package/dist/lib/commands/context.js +59 -0
- package/dist/lib/commands/context.js.map +1 -0
- package/dist/lib/commands/core.d.ts +11 -0
- package/dist/lib/commands/core.d.ts.map +1 -0
- package/dist/lib/commands/core.js +246 -0
- package/dist/lib/commands/core.js.map +1 -0
- package/dist/lib/commands/doi.d.ts +11 -0
- package/dist/lib/commands/doi.d.ts.map +1 -0
- package/dist/lib/commands/doi.js +373 -0
- package/dist/lib/commands/doi.js.map +1 -0
- package/dist/lib/commands/history.d.ts +11 -0
- package/dist/lib/commands/history.d.ts.map +1 -0
- package/dist/lib/commands/history.js +245 -0
- package/dist/lib/commands/history.js.map +1 -0
- package/dist/lib/commands/index.d.ts +28 -0
- package/dist/lib/commands/index.d.ts.map +1 -0
- package/dist/lib/commands/index.js +35 -0
- package/dist/lib/commands/index.js.map +1 -0
- package/dist/lib/commands/init.d.ts +11 -0
- package/dist/lib/commands/init.d.ts.map +1 -0
- package/dist/lib/commands/init.js +209 -0
- package/dist/lib/commands/init.js.map +1 -0
- package/dist/lib/commands/response.d.ts +11 -0
- package/dist/lib/commands/response.d.ts.map +1 -0
- package/dist/lib/commands/response.js +317 -0
- package/dist/lib/commands/response.js.map +1 -0
- package/dist/lib/commands/sections.d.ts +11 -0
- package/dist/lib/commands/sections.d.ts.map +1 -0
- package/dist/lib/commands/sections.js +1071 -0
- package/dist/lib/commands/sections.js.map +1 -0
- package/dist/lib/commands/utilities.d.ts +19 -0
- package/dist/lib/commands/utilities.d.ts.map +1 -0
- package/dist/lib/commands/utilities.js +2009 -0
- package/dist/lib/commands/utilities.js.map +1 -0
- package/dist/lib/comment-realign.d.ts +50 -0
- package/dist/lib/comment-realign.d.ts.map +1 -0
- package/dist/lib/comment-realign.js +372 -0
- package/dist/lib/comment-realign.js.map +1 -0
- package/dist/lib/config.d.ts +41 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +76 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/crossref.d.ts +108 -0
- package/dist/lib/crossref.d.ts.map +1 -0
- package/dist/lib/crossref.js +597 -0
- package/dist/lib/crossref.js.map +1 -0
- package/dist/lib/dependencies.d.ts +30 -0
- package/dist/lib/dependencies.d.ts.map +1 -0
- package/dist/lib/dependencies.js +95 -0
- package/dist/lib/dependencies.js.map +1 -0
- package/dist/lib/doi-cache.d.ts +29 -0
- package/dist/lib/doi-cache.d.ts.map +1 -0
- package/dist/lib/doi-cache.js +104 -0
- package/dist/lib/doi-cache.js.map +1 -0
- package/dist/lib/doi.d.ts +65 -0
- package/dist/lib/doi.d.ts.map +1 -0
- package/dist/lib/doi.js +710 -0
- package/dist/lib/doi.js.map +1 -0
- package/dist/lib/equations.d.ts +61 -0
- package/dist/lib/equations.d.ts.map +1 -0
- package/dist/lib/equations.js +445 -0
- package/dist/lib/equations.js.map +1 -0
- package/dist/lib/errors.d.ts +60 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +303 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/format.d.ts +104 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +416 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/git.d.ts +88 -0
- package/dist/lib/git.d.ts.map +1 -0
- package/dist/lib/git.js +304 -0
- package/dist/lib/git.js.map +1 -0
- package/dist/lib/grammar.d.ts +62 -0
- package/dist/lib/grammar.d.ts.map +1 -0
- package/dist/lib/grammar.js +244 -0
- package/dist/lib/grammar.js.map +1 -0
- package/dist/lib/image-registry.d.ts +68 -0
- package/dist/lib/image-registry.d.ts.map +1 -0
- package/dist/lib/image-registry.js +112 -0
- package/dist/lib/image-registry.js.map +1 -0
- package/dist/lib/import.d.ts +184 -0
- package/dist/lib/import.d.ts.map +1 -0
- package/dist/lib/import.js +1581 -0
- package/dist/lib/import.js.map +1 -0
- package/dist/lib/journals.d.ts +55 -0
- package/dist/lib/journals.d.ts.map +1 -0
- package/dist/lib/journals.js +417 -0
- package/dist/lib/journals.js.map +1 -0
- package/dist/lib/merge.d.ts +138 -0
- package/dist/lib/merge.d.ts.map +1 -0
- package/dist/lib/merge.js +603 -0
- package/dist/lib/merge.js.map +1 -0
- package/dist/lib/orcid.d.ts +36 -0
- package/dist/lib/orcid.d.ts.map +1 -0
- package/dist/lib/orcid.js +117 -0
- package/dist/lib/orcid.js.map +1 -0
- package/dist/lib/pdf-comments.d.ts +95 -0
- package/dist/lib/pdf-comments.d.ts.map +1 -0
- package/dist/lib/pdf-comments.js +192 -0
- package/dist/lib/pdf-comments.js.map +1 -0
- package/dist/lib/pdf-import.d.ts +118 -0
- package/dist/lib/pdf-import.d.ts.map +1 -0
- package/dist/lib/pdf-import.js +397 -0
- package/dist/lib/pdf-import.js.map +1 -0
- package/dist/lib/plugins.d.ts +76 -0
- package/dist/lib/plugins.d.ts.map +1 -0
- package/dist/lib/plugins.js +235 -0
- package/dist/lib/plugins.js.map +1 -0
- package/dist/lib/postprocess.d.ts +42 -0
- package/dist/lib/postprocess.d.ts.map +1 -0
- package/dist/lib/postprocess.js +138 -0
- package/dist/lib/postprocess.js.map +1 -0
- package/dist/lib/pptx-template.d.ts +59 -0
- package/dist/lib/pptx-template.d.ts.map +1 -0
- package/dist/lib/pptx-template.js +613 -0
- package/dist/lib/pptx-template.js.map +1 -0
- package/dist/lib/pptx-themes.d.ts +80 -0
- package/dist/lib/pptx-themes.d.ts.map +1 -0
- package/dist/lib/pptx-themes.js +818 -0
- package/dist/lib/pptx-themes.js.map +1 -0
- package/dist/lib/protect-restore.d.ts +137 -0
- package/dist/lib/protect-restore.d.ts.map +1 -0
- package/dist/lib/protect-restore.js +394 -0
- package/dist/lib/protect-restore.js.map +1 -0
- package/dist/lib/rate-limiter.d.ts +27 -0
- package/dist/lib/rate-limiter.d.ts.map +1 -0
- package/dist/lib/rate-limiter.js +79 -0
- package/dist/lib/rate-limiter.js.map +1 -0
- package/dist/lib/response.d.ts +41 -0
- package/dist/lib/response.d.ts.map +1 -0
- package/dist/lib/response.js +150 -0
- package/dist/lib/response.js.map +1 -0
- package/dist/lib/review.d.ts +35 -0
- package/dist/lib/review.d.ts.map +1 -0
- package/dist/lib/review.js +263 -0
- package/dist/lib/review.js.map +1 -0
- package/dist/lib/schema.d.ts +66 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/schema.js +339 -0
- package/dist/lib/schema.js.map +1 -0
- package/dist/lib/scientific-words.d.ts +6 -0
- package/dist/lib/scientific-words.d.ts.map +1 -0
- package/dist/lib/scientific-words.js +66 -0
- package/dist/lib/scientific-words.js.map +1 -0
- package/dist/lib/sections.d.ts +40 -0
- package/dist/lib/sections.d.ts.map +1 -0
- package/dist/lib/sections.js +288 -0
- package/dist/lib/sections.js.map +1 -0
- package/dist/lib/slides.d.ts +86 -0
- package/dist/lib/slides.d.ts.map +1 -0
- package/dist/lib/slides.js +676 -0
- package/dist/lib/slides.js.map +1 -0
- package/dist/lib/spelling.d.ts +76 -0
- package/dist/lib/spelling.d.ts.map +1 -0
- package/dist/lib/spelling.js +272 -0
- package/dist/lib/spelling.js.map +1 -0
- package/dist/lib/templates.d.ts +30 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +504 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/themes.d.ts +85 -0
- package/dist/lib/themes.d.ts.map +1 -0
- package/dist/lib/themes.js +652 -0
- package/dist/lib/themes.js.map +1 -0
- package/dist/lib/trackchanges.d.ts +51 -0
- package/dist/lib/trackchanges.d.ts.map +1 -0
- package/dist/lib/trackchanges.js +202 -0
- package/dist/lib/trackchanges.js.map +1 -0
- package/dist/lib/tui.d.ts +76 -0
- package/dist/lib/tui.d.ts.map +1 -0
- package/dist/lib/tui.js +377 -0
- package/dist/lib/tui.js.map +1 -0
- package/dist/lib/types.d.ts +447 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +6 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/undo.d.ts +57 -0
- package/dist/lib/undo.d.ts.map +1 -0
- package/dist/lib/undo.js +185 -0
- package/dist/lib/undo.js.map +1 -0
- package/dist/lib/utils.d.ts +16 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +40 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/variables.d.ts +42 -0
- package/dist/lib/variables.d.ts.map +1 -0
- package/dist/lib/variables.js +141 -0
- package/dist/lib/variables.js.map +1 -0
- package/dist/lib/word.d.ts +80 -0
- package/dist/lib/word.d.ts.map +1 -0
- package/dist/lib/word.js +360 -0
- package/dist/lib/word.js.map +1 -0
- package/dist/lib/wordcomments.d.ts +51 -0
- package/dist/lib/wordcomments.d.ts.map +1 -0
- package/dist/lib/wordcomments.js +587 -0
- package/dist/lib/wordcomments.js.map +1 -0
- package/eslint.config.js +27 -0
- package/lib/annotations.ts +622 -0
- package/lib/apply-buildup-colors.py +88 -0
- package/lib/build.ts +1013 -0
- package/lib/{citations.js → citations.ts} +38 -27
- package/lib/commands/{build.js → build.ts} +80 -27
- package/lib/commands/{citations.js → citations.ts} +36 -18
- package/lib/commands/{comments.js → comments.ts} +187 -54
- package/lib/commands/{context.js → context.ts} +18 -8
- package/lib/commands/{core.js → core.ts} +34 -20
- package/lib/commands/{doi.js → doi.ts} +32 -16
- package/lib/commands/{history.js → history.ts} +25 -12
- package/lib/commands/{index.js → index.ts} +9 -5
- package/lib/commands/{init.js → init.ts} +20 -8
- package/lib/commands/{response.js → response.ts} +47 -20
- package/lib/commands/{sections.js → sections.ts} +273 -68
- package/lib/commands/{utilities.js → utilities.ts} +338 -158
- package/lib/{comment-realign.js → comment-realign.ts} +117 -45
- package/lib/config.ts +84 -0
- package/lib/{crossref.js → crossref.ts} +213 -138
- package/lib/dependencies.ts +106 -0
- package/lib/doi-cache.ts +115 -0
- package/lib/{doi.js → doi.ts} +115 -281
- package/lib/{equations.js → equations.ts} +60 -64
- package/lib/{errors.js → errors.ts} +56 -48
- package/lib/{format.js → format.ts} +137 -63
- package/lib/{git.js → git.ts} +66 -63
- package/lib/{grammar.js → grammar.ts} +45 -32
- package/lib/image-registry.ts +180 -0
- package/lib/import.ts +2060 -0
- package/lib/journals.ts +505 -0
- package/lib/{merge.js → merge.ts} +185 -135
- package/lib/{orcid.js → orcid.ts} +17 -22
- package/lib/{pdf-comments.js → pdf-comments.ts} +76 -18
- package/lib/{pdf-import.js → pdf-import.ts} +148 -70
- package/lib/{plugins.js → plugins.ts} +82 -39
- package/lib/postprocess.ts +188 -0
- package/lib/pptx-color-filter.lua +37 -0
- package/lib/pptx-template.ts +625 -0
- package/lib/pptx-themes/academic.pptx +0 -0
- package/lib/pptx-themes/corporate.pptx +0 -0
- package/lib/pptx-themes/dark.pptx +0 -0
- package/lib/pptx-themes/default.pptx +0 -0
- package/lib/pptx-themes/minimal.pptx +0 -0
- package/lib/pptx-themes/plant.pptx +0 -0
- package/lib/pptx-themes.ts +896 -0
- package/lib/protect-restore.ts +516 -0
- package/lib/rate-limiter.ts +94 -0
- package/lib/{response.js → response.ts} +36 -21
- package/lib/{review.js → review.ts} +53 -43
- package/lib/{schema.js → schema.ts} +70 -25
- package/lib/{sections.js → sections.ts} +71 -76
- package/lib/slides.ts +793 -0
- package/lib/{spelling.js → spelling.ts} +43 -59
- package/lib/{templates.js → templates.ts} +20 -17
- package/lib/themes.ts +742 -0
- package/lib/{trackchanges.js → trackchanges.ts} +52 -23
- package/lib/types.ts +509 -0
- package/lib/{undo.js → undo.ts} +75 -52
- package/lib/utils.ts +41 -0
- package/lib/{variables.js → variables.ts} +60 -54
- package/lib/word.ts +428 -0
- package/lib/{wordcomments.js → wordcomments.ts} +94 -40
- package/package.json +15 -5
- package/skill/REFERENCE.md +67 -0
- package/tsconfig.json +26 -0
- package/lib/annotations.js +0 -414
- package/lib/build.js +0 -639
- package/lib/config.js +0 -79
- package/lib/import.js +0 -1145
- package/lib/journals.js +0 -629
- package/lib/word.js +0 -225
- /package/lib/{scientific-words.js → scientific-words.ts} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track changes module - Apply markdown annotations as Word track changes
|
|
3
|
+
*
|
|
4
|
+
* Converts CriticMarkup annotations to Word OOXML track changes format.
|
|
5
|
+
*/
|
|
6
|
+
import type { TrackChangeMarker } from './types.js';
|
|
7
|
+
interface PrepareOptions {
|
|
8
|
+
author?: string;
|
|
9
|
+
}
|
|
10
|
+
interface PrepareResult {
|
|
11
|
+
text: string;
|
|
12
|
+
markers: TrackChangeMarker[];
|
|
13
|
+
}
|
|
14
|
+
interface ApplyResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
message: string;
|
|
17
|
+
stats?: {
|
|
18
|
+
insertions: number;
|
|
19
|
+
deletions: number;
|
|
20
|
+
substitutions: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Prepare text with CriticMarkup annotations for track changes
|
|
25
|
+
* Replaces annotations with markers that can be processed in DOCX
|
|
26
|
+
*
|
|
27
|
+
* @param text - Text with CriticMarkup annotations
|
|
28
|
+
* @param options - Options
|
|
29
|
+
* @returns Processed text and marker info
|
|
30
|
+
*/
|
|
31
|
+
export declare function prepareForTrackChanges(text: string, options?: PrepareOptions): PrepareResult;
|
|
32
|
+
/**
|
|
33
|
+
* Apply track changes markers to a Word document
|
|
34
|
+
*
|
|
35
|
+
* @param docxPath - Path to input DOCX file
|
|
36
|
+
* @param markers - Markers from prepareForTrackChanges
|
|
37
|
+
* @param outputPath - Path for output DOCX file
|
|
38
|
+
* @returns Result with success status and message
|
|
39
|
+
*/
|
|
40
|
+
export declare function applyTrackChangesToDocx(docxPath: string, markers: TrackChangeMarker[], outputPath: string): Promise<ApplyResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Build a Word document with track changes from annotated markdown
|
|
43
|
+
*
|
|
44
|
+
* @param mdPath - Path to markdown file with CriticMarkup
|
|
45
|
+
* @param docxPath - Output path for Word document
|
|
46
|
+
* @param options - Options
|
|
47
|
+
* @returns Result with success status and message
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildWithTrackChanges(mdPath: string, docxPath: string, options?: PrepareOptions): Promise<ApplyResult>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=trackchanges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackchanges.d.ts","sourceRoot":"","sources":["../../lib/trackchanges.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAcD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,CAiEhG;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,iBAAiB,EAAE,EAC5B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,CAAC,CAgEtB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAiDtB"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track changes module - Apply markdown annotations as Word track changes
|
|
3
|
+
*
|
|
4
|
+
* Converts CriticMarkup annotations to Word OOXML track changes format.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
import AdmZip from 'adm-zip';
|
|
10
|
+
/**
|
|
11
|
+
* Escape XML special characters
|
|
12
|
+
*/
|
|
13
|
+
function escapeXml(str) {
|
|
14
|
+
return str
|
|
15
|
+
.replace(/&/g, '&')
|
|
16
|
+
.replace(/</g, '<')
|
|
17
|
+
.replace(/>/g, '>')
|
|
18
|
+
.replace(/"/g, '"')
|
|
19
|
+
.replace(/'/g, ''');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Prepare text with CriticMarkup annotations for track changes
|
|
23
|
+
* Replaces annotations with markers that can be processed in DOCX
|
|
24
|
+
*
|
|
25
|
+
* @param text - Text with CriticMarkup annotations
|
|
26
|
+
* @param options - Options
|
|
27
|
+
* @returns Processed text and marker info
|
|
28
|
+
*/
|
|
29
|
+
export function prepareForTrackChanges(text, options = {}) {
|
|
30
|
+
const { author = 'Reviewer' } = options;
|
|
31
|
+
const markers = [];
|
|
32
|
+
let markerId = 0;
|
|
33
|
+
let result = text;
|
|
34
|
+
// Process insertions: {++text++}
|
|
35
|
+
result = result.replace(/\{\+\+(.+?)\+\+\}/gs, (match, content) => {
|
|
36
|
+
const id = markerId++;
|
|
37
|
+
markers.push({
|
|
38
|
+
id,
|
|
39
|
+
type: 'insert',
|
|
40
|
+
content,
|
|
41
|
+
author,
|
|
42
|
+
});
|
|
43
|
+
return `{{TC_${id}}}`;
|
|
44
|
+
});
|
|
45
|
+
// Process deletions: {--text--}
|
|
46
|
+
result = result.replace(/\{--(.+?)--\}/gs, (match, content) => {
|
|
47
|
+
const id = markerId++;
|
|
48
|
+
markers.push({
|
|
49
|
+
id,
|
|
50
|
+
type: 'delete',
|
|
51
|
+
content,
|
|
52
|
+
author,
|
|
53
|
+
});
|
|
54
|
+
return `{{TC_${id}}}`;
|
|
55
|
+
});
|
|
56
|
+
// Process substitutions: {~~old~>new~~}
|
|
57
|
+
result = result.replace(/\{~~(.+?)~>(.+?)~~\}/gs, (match, old, replacement) => {
|
|
58
|
+
const id = markerId++;
|
|
59
|
+
markers.push({
|
|
60
|
+
id,
|
|
61
|
+
type: 'substitute',
|
|
62
|
+
content: old,
|
|
63
|
+
replacement,
|
|
64
|
+
author,
|
|
65
|
+
});
|
|
66
|
+
return `{{TC_${id}}}`;
|
|
67
|
+
});
|
|
68
|
+
// Process comments: {>>Author: comment<<}
|
|
69
|
+
result = result.replace(/\{>>(.+?)<<\}/gs, (match, content) => {
|
|
70
|
+
const id = markerId++;
|
|
71
|
+
// Extract author if present (format: "Author: comment")
|
|
72
|
+
const colonIdx = content.indexOf(':');
|
|
73
|
+
let commentAuthor = author;
|
|
74
|
+
let commentText = content;
|
|
75
|
+
if (colonIdx > 0 && colonIdx < 30) {
|
|
76
|
+
commentAuthor = content.slice(0, colonIdx).trim();
|
|
77
|
+
commentText = content.slice(colonIdx + 1).trim();
|
|
78
|
+
}
|
|
79
|
+
markers.push({
|
|
80
|
+
id,
|
|
81
|
+
type: 'comment',
|
|
82
|
+
content: commentText,
|
|
83
|
+
author: commentAuthor,
|
|
84
|
+
});
|
|
85
|
+
return `{{TC_${id}}}`;
|
|
86
|
+
});
|
|
87
|
+
return { text: result, markers };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Apply track changes markers to a Word document
|
|
91
|
+
*
|
|
92
|
+
* @param docxPath - Path to input DOCX file
|
|
93
|
+
* @param markers - Markers from prepareForTrackChanges
|
|
94
|
+
* @param outputPath - Path for output DOCX file
|
|
95
|
+
* @returns Result with success status and message
|
|
96
|
+
*/
|
|
97
|
+
export async function applyTrackChangesToDocx(docxPath, markers, outputPath) {
|
|
98
|
+
if (!fs.existsSync(docxPath)) {
|
|
99
|
+
return { success: false, message: `File not found: ${docxPath}` };
|
|
100
|
+
}
|
|
101
|
+
let zip;
|
|
102
|
+
try {
|
|
103
|
+
zip = new AdmZip(docxPath);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
const error = err;
|
|
107
|
+
return { success: false, message: `Invalid DOCX file: ${error.message}` };
|
|
108
|
+
}
|
|
109
|
+
// Read document.xml
|
|
110
|
+
const docEntry = zip.getEntry('word/document.xml');
|
|
111
|
+
if (!docEntry) {
|
|
112
|
+
return { success: false, message: 'Invalid DOCX: no document.xml' };
|
|
113
|
+
}
|
|
114
|
+
let documentXml = zip.readAsText(docEntry);
|
|
115
|
+
// Generate ISO date for track changes
|
|
116
|
+
const now = new Date().toISOString();
|
|
117
|
+
// Replace markers with track change XML
|
|
118
|
+
for (const marker of markers) {
|
|
119
|
+
const placeholder = `{{TC_${marker.id}}}`;
|
|
120
|
+
let replacement = '';
|
|
121
|
+
const escapedContent = escapeXml(marker.content);
|
|
122
|
+
const escapedAuthor = escapeXml(marker.author);
|
|
123
|
+
if (marker.type === 'insert') {
|
|
124
|
+
replacement = `<w:ins w:id="${marker.id}" w:author="${escapedAuthor}" w:date="${now}"><w:r><w:t>${escapedContent}</w:t></w:r></w:ins>`;
|
|
125
|
+
}
|
|
126
|
+
else if (marker.type === 'delete') {
|
|
127
|
+
replacement = `<w:del w:id="${marker.id}" w:author="${escapedAuthor}" w:date="${now}"><w:r><w:delText>${escapedContent}</w:delText></w:r></w:del>`;
|
|
128
|
+
}
|
|
129
|
+
else if (marker.type === 'substitute') {
|
|
130
|
+
const escapedReplacement = escapeXml(marker.replacement || '');
|
|
131
|
+
replacement = `<w:del w:id="${marker.id}" w:author="${escapedAuthor}" w:date="${now}"><w:r><w:delText>${escapedContent}</w:delText></w:r></w:del><w:ins w:id="${marker.id + 1000}" w:author="${escapedAuthor}" w:date="${now}"><w:r><w:t>${escapedReplacement}</w:t></w:r></w:ins>`;
|
|
132
|
+
}
|
|
133
|
+
documentXml = documentXml.replace(placeholder, replacement);
|
|
134
|
+
}
|
|
135
|
+
// Update document.xml
|
|
136
|
+
zip.updateFile('word/document.xml', Buffer.from(documentXml));
|
|
137
|
+
// Enable track revisions in settings.xml
|
|
138
|
+
const settingsEntry = zip.getEntry('word/settings.xml');
|
|
139
|
+
if (settingsEntry) {
|
|
140
|
+
let settingsXml = zip.readAsText(settingsEntry);
|
|
141
|
+
if (!settingsXml.includes('w:trackRevisions')) {
|
|
142
|
+
settingsXml = settingsXml.replace('</w:settings>', '<w:trackRevisions/></w:settings>');
|
|
143
|
+
zip.updateFile('word/settings.xml', Buffer.from(settingsXml));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Write output
|
|
147
|
+
zip.writeZip(outputPath);
|
|
148
|
+
return { success: true, message: `Created ${outputPath} with track changes` };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Build a Word document with track changes from annotated markdown
|
|
152
|
+
*
|
|
153
|
+
* @param mdPath - Path to markdown file with CriticMarkup
|
|
154
|
+
* @param docxPath - Output path for Word document
|
|
155
|
+
* @param options - Options
|
|
156
|
+
* @returns Result with success status and message
|
|
157
|
+
*/
|
|
158
|
+
export async function buildWithTrackChanges(mdPath, docxPath, options = {}) {
|
|
159
|
+
const { author = 'Author' } = options;
|
|
160
|
+
if (!fs.existsSync(mdPath)) {
|
|
161
|
+
return { success: false, message: `File not found: ${mdPath}` };
|
|
162
|
+
}
|
|
163
|
+
const content = fs.readFileSync(mdPath, 'utf-8');
|
|
164
|
+
// Prepare for track changes
|
|
165
|
+
const { text: prepared, markers } = prepareForTrackChanges(content, { author });
|
|
166
|
+
// If no annotations, just build normally
|
|
167
|
+
if (markers.length === 0) {
|
|
168
|
+
try {
|
|
169
|
+
execSync(`pandoc "${mdPath}" -o "${docxPath}"`, { encoding: 'utf-8' });
|
|
170
|
+
return { success: true, message: `Created ${docxPath}` };
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
const error = err;
|
|
174
|
+
return { success: false, message: error.message };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Write prepared content to temp file
|
|
178
|
+
const tempDir = path.dirname(mdPath);
|
|
179
|
+
const tempMd = path.join(tempDir, `.temp-${Date.now()}.md`);
|
|
180
|
+
const tempDocx = path.join(tempDir, `.temp-${Date.now()}.docx`);
|
|
181
|
+
try {
|
|
182
|
+
fs.writeFileSync(tempMd, prepared, 'utf-8');
|
|
183
|
+
// Build with pandoc
|
|
184
|
+
execSync(`pandoc "${tempMd}" -o "${tempDocx}"`, { encoding: 'utf-8' });
|
|
185
|
+
// Apply track changes
|
|
186
|
+
const result = await applyTrackChangesToDocx(tempDocx, markers, docxPath);
|
|
187
|
+
// Clean up temp files
|
|
188
|
+
fs.unlinkSync(tempMd);
|
|
189
|
+
fs.unlinkSync(tempDocx);
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
// Clean up on error
|
|
194
|
+
if (fs.existsSync(tempMd))
|
|
195
|
+
fs.unlinkSync(tempMd);
|
|
196
|
+
if (fs.existsSync(tempDocx))
|
|
197
|
+
fs.unlinkSync(tempDocx);
|
|
198
|
+
const error = err;
|
|
199
|
+
return { success: false, message: error.message };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=trackchanges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackchanges.js","sourceRoot":"","sources":["../../lib/trackchanges.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,MAAM,MAAM,SAAS,CAAC;AAsB7B;;GAEG;AACH,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG;SACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE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AAsB;QACtB,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE1E,sBAAsB;QACtB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtB,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAExB,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,oBAAoB;QACpB,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,GAAY,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clear the terminal screen
|
|
3
|
+
*/
|
|
4
|
+
export function clearScreen(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Move cursor to position
|
|
7
|
+
* @param {number} row
|
|
8
|
+
* @param {number} col
|
|
9
|
+
*/
|
|
10
|
+
export function moveCursor(row: number, col: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get terminal dimensions
|
|
13
|
+
* @returns {{rows: number, cols: number}}
|
|
14
|
+
*/
|
|
15
|
+
export function getTerminalSize(): {
|
|
16
|
+
rows: number;
|
|
17
|
+
cols: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Draw a box with content
|
|
21
|
+
* @param {object} options
|
|
22
|
+
* @param {string} options.title
|
|
23
|
+
* @param {string[]} options.content
|
|
24
|
+
* @param {number} options.width
|
|
25
|
+
* @param {string} options.borderColor
|
|
26
|
+
* @returns {string[]}
|
|
27
|
+
*/
|
|
28
|
+
export function drawBox({ title, content, width, borderColor }: {
|
|
29
|
+
title: string;
|
|
30
|
+
content: string[];
|
|
31
|
+
width: number;
|
|
32
|
+
borderColor: string;
|
|
33
|
+
}): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Draw a status bar at the bottom of the screen
|
|
36
|
+
* @param {string} left - Left-aligned text
|
|
37
|
+
* @param {string} right - Right-aligned text
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
export function statusBar(left: string, right?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Draw a progress indicator
|
|
43
|
+
* @param {number} current
|
|
44
|
+
* @param {number} total
|
|
45
|
+
* @param {number} width
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
export function progressIndicator(current: number, total: number, width?: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Format a comment for TUI display
|
|
51
|
+
* @param {object} comment
|
|
52
|
+
* @param {number} index
|
|
53
|
+
* @param {number} total
|
|
54
|
+
* @param {number} width
|
|
55
|
+
* @returns {string[]}
|
|
56
|
+
*/
|
|
57
|
+
export function formatCommentCard(comment: object, index: number, total: number, width?: number): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Draw the action menu
|
|
60
|
+
* @param {string[]} options - Array of [key, description] tuples
|
|
61
|
+
* @returns {string}
|
|
62
|
+
*/
|
|
63
|
+
export function actionMenu(options: string[]): string;
|
|
64
|
+
/**
|
|
65
|
+
* Run TUI comment review session
|
|
66
|
+
* @param {string} text
|
|
67
|
+
* @param {object} options
|
|
68
|
+
* @returns {Promise<{text: string, resolved: number, replied: number, skipped: number}>}
|
|
69
|
+
*/
|
|
70
|
+
export function tuiCommentReview(text: string, options?: object): Promise<{
|
|
71
|
+
text: string;
|
|
72
|
+
resolved: number;
|
|
73
|
+
replied: number;
|
|
74
|
+
skipped: number;
|
|
75
|
+
}>;
|
|
76
|
+
//# sourceMappingURL=tui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../lib/tui.js"],"names":[],"mappings":"AAQA;;GAEG;AACH,oCAEC;AAED;;;;GAIG;AACH,gCAHW,MAAM,OACN,MAAM,QAIhB;AAED;;;GAGG;AACH,mCAFa;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAOxC;AAED;;;;;;;;GAQG;AACH,gEANG;IAAwB,KAAK,EAArB,MAAM;IACY,OAAO,EAAzB,MAAM,EAAE;IACQ,KAAK,EAArB,MAAM;IACU,WAAW,EAA3B,MAAM;CACd,GAAU,MAAM,EAAE,CAqCpB;AAED;;;;;GAKG;AACH,gCAJW,MAAM,UACN,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;GAMG;AACH,2CALW,MAAM,SACN,MAAM,UACN,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;;GAOG;AACH,2CANW,MAAM,SACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,MAAM,EAAE,CAmCpB;AAED;;;;GAIG;AACH,oCAHW,MAAM,EAAE,GACN,MAAM,CAMlB;AAmCD;;;;;GAKG;AACH,uCAJW,MAAM,YACN,MAAM,GACJ,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC,CAyOvF"}
|