docrev 0.9.5 → 0.9.7
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/CHANGELOG.md +20 -0
- package/dev_notes/bug_repro_comment_parser.md +71 -0
- package/dist/lib/anchor-match.d.ts +41 -0
- package/dist/lib/anchor-match.d.ts.map +1 -0
- package/dist/lib/anchor-match.js +192 -0
- package/dist/lib/anchor-match.js.map +1 -0
- package/dist/lib/annotations.d.ts.map +1 -1
- package/dist/lib/annotations.js +8 -5
- package/dist/lib/annotations.js.map +1 -1
- package/dist/lib/commands/file-ops.d.ts +11 -0
- package/dist/lib/commands/file-ops.d.ts.map +1 -0
- package/dist/lib/commands/file-ops.js +301 -0
- package/dist/lib/commands/file-ops.js.map +1 -0
- package/dist/lib/commands/index.d.ts +10 -1
- package/dist/lib/commands/index.d.ts.map +1 -1
- package/dist/lib/commands/index.js +19 -1
- package/dist/lib/commands/index.js.map +1 -1
- package/dist/lib/commands/merge-resolve.d.ts +12 -0
- package/dist/lib/commands/merge-resolve.d.ts.map +1 -0
- package/dist/lib/commands/merge-resolve.js +318 -0
- package/dist/lib/commands/merge-resolve.js.map +1 -0
- package/dist/lib/commands/preview.d.ts +11 -0
- package/dist/lib/commands/preview.d.ts.map +1 -0
- package/dist/lib/commands/preview.js +138 -0
- package/dist/lib/commands/preview.js.map +1 -0
- package/dist/lib/commands/project-info.d.ts +11 -0
- package/dist/lib/commands/project-info.d.ts.map +1 -0
- package/dist/lib/commands/project-info.js +187 -0
- package/dist/lib/commands/project-info.js.map +1 -0
- package/dist/lib/commands/quality.d.ts +11 -0
- package/dist/lib/commands/quality.d.ts.map +1 -0
- package/dist/lib/commands/quality.js +384 -0
- package/dist/lib/commands/quality.js.map +1 -0
- package/dist/lib/commands/section-boundaries.d.ts +22 -0
- package/dist/lib/commands/section-boundaries.d.ts.map +1 -0
- package/dist/lib/commands/section-boundaries.js +53 -0
- package/dist/lib/commands/section-boundaries.js.map +1 -0
- package/dist/lib/commands/sections.d.ts +3 -2
- package/dist/lib/commands/sections.d.ts.map +1 -1
- package/dist/lib/commands/sections.js +4 -736
- package/dist/lib/commands/sections.js.map +1 -1
- package/dist/lib/commands/sync.d.ts +11 -0
- package/dist/lib/commands/sync.d.ts.map +1 -0
- package/dist/lib/commands/sync.js +576 -0
- package/dist/lib/commands/sync.js.map +1 -0
- package/dist/lib/commands/text-ops.d.ts +11 -0
- package/dist/lib/commands/text-ops.d.ts.map +1 -0
- package/dist/lib/commands/text-ops.js +357 -0
- package/dist/lib/commands/text-ops.js.map +1 -0
- package/dist/lib/commands/utilities.d.ts +2 -4
- package/dist/lib/commands/utilities.d.ts.map +1 -1
- package/dist/lib/commands/utilities.js +3 -1572
- package/dist/lib/commands/utilities.js.map +1 -1
- package/dist/lib/commands/verify-anchors.d.ts +17 -0
- package/dist/lib/commands/verify-anchors.d.ts.map +1 -0
- package/dist/lib/commands/verify-anchors.js +215 -0
- package/dist/lib/commands/verify-anchors.js.map +1 -0
- package/dist/lib/commands/word-tools.d.ts +11 -0
- package/dist/lib/commands/word-tools.d.ts.map +1 -0
- package/dist/lib/commands/word-tools.js +272 -0
- package/dist/lib/commands/word-tools.js.map +1 -0
- package/dist/lib/diff-engine.d.ts +25 -0
- package/dist/lib/diff-engine.d.ts.map +1 -0
- package/dist/lib/diff-engine.js +354 -0
- package/dist/lib/diff-engine.js.map +1 -0
- package/dist/lib/import.d.ts +44 -118
- package/dist/lib/import.d.ts.map +1 -1
- package/dist/lib/import.js +25 -1173
- package/dist/lib/import.js.map +1 -1
- package/dist/lib/restore-references.d.ts +35 -0
- package/dist/lib/restore-references.d.ts.map +1 -0
- package/dist/lib/restore-references.js +188 -0
- package/dist/lib/restore-references.js.map +1 -0
- package/dist/lib/word-extraction.d.ts +100 -0
- package/dist/lib/word-extraction.d.ts.map +1 -0
- package/dist/lib/word-extraction.js +594 -0
- package/dist/lib/word-extraction.js.map +1 -0
- package/lib/anchor-match.ts +238 -0
- package/lib/annotations.ts +9 -5
- package/lib/commands/file-ops.ts +372 -0
- package/lib/commands/index.ts +27 -0
- package/lib/commands/merge-resolve.ts +378 -0
- package/lib/commands/preview.ts +178 -0
- package/lib/commands/project-info.ts +244 -0
- package/lib/commands/quality.ts +517 -0
- package/lib/commands/section-boundaries.ts +72 -0
- package/lib/commands/sections.ts +3 -870
- package/lib/commands/sync.ts +701 -0
- package/lib/commands/text-ops.ts +449 -0
- package/lib/commands/utilities.ts +62 -2043
- package/lib/commands/verify-anchors.ts +261 -0
- package/lib/commands/word-tools.ts +340 -0
- package/lib/diff-engine.ts +465 -0
- package/lib/import.ts +108 -1504
- package/lib/restore-references.ts +240 -0
- package/lib/word-extraction.ts +759 -0
- package/package.json +1 -1
- package/skill/REFERENCE.md +29 -2
- package/skill/SKILL.md +12 -2
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff engine - diffing and annotation processing for Word→Markdown import
|
|
3
|
+
*/
|
|
4
|
+
import { diffWords } from 'diff';
|
|
5
|
+
import { extractMarkdownPrefix, protectAnchors, restoreAnchors, protectCrossrefs, restoreCrossrefs, protectMath, restoreMath, replaceRenderedMath, protectCitations, restoreCitations, replaceRenderedCitations, protectImages, restoreImages, matchWordImagesToOriginal, protectTables, restoreTables, } from './protect-restore.js';
|
|
6
|
+
import { normalizeWhitespace } from './utils.js';
|
|
7
|
+
// ============================================
|
|
8
|
+
// Functions
|
|
9
|
+
// ============================================
|
|
10
|
+
/**
|
|
11
|
+
* Fix citation and math annotations by preserving original markdown syntax
|
|
12
|
+
*/
|
|
13
|
+
export function fixCitationAnnotations(text, originalMd) {
|
|
14
|
+
// Fix math annotations - preserve inline and display math
|
|
15
|
+
text = text.replace(/\{--(\$[^$]+\$)--\}/g, '$1');
|
|
16
|
+
text = text.replace(/\{--(\$\$[^$]+\$\$)--\}/g, '$1');
|
|
17
|
+
text = text.replace(/\{~~(\$[^$]+\$)~>[^~]+~~\}/g, '$1');
|
|
18
|
+
text = text.replace(/\{~~(\$\$[^$]+\$\$)~>[^~]+~~\}/g, '$1');
|
|
19
|
+
// Extract all citations from original markdown
|
|
20
|
+
const citationPattern = /\[@[^\]]+\]/g;
|
|
21
|
+
const originalCitations = [...originalMd.matchAll(citationPattern)].map(m => m[0]);
|
|
22
|
+
// Fix substitutions where left side has markdown citation
|
|
23
|
+
text = text.replace(/\{~~(\[@[^\]]+\])~>[^~]+~~\}/g, '$1');
|
|
24
|
+
// Fix substitutions where left side STARTS with markdown citation
|
|
25
|
+
text = text.replace(/\{~~(\[@[^\]]+\])\s*([^~]*)~>([^~]*)~~\}/g, (match, cite, oldText, newText) => {
|
|
26
|
+
if (oldText.trim() === '' && newText.trim() === '') {
|
|
27
|
+
return cite;
|
|
28
|
+
}
|
|
29
|
+
if (oldText.trim() || newText.trim()) {
|
|
30
|
+
return cite + (oldText.trim() !== newText.trim() ? ` {~~${oldText.trim()}~>${newText.trim()}~~}` : ` ${newText}`);
|
|
31
|
+
}
|
|
32
|
+
return cite;
|
|
33
|
+
});
|
|
34
|
+
// Fix deletions of markdown citations
|
|
35
|
+
text = text.replace(/\{--(\[@[^\]]+\])--\}/g, '$1');
|
|
36
|
+
// Fix insertions of rendered citations
|
|
37
|
+
text = text.replace(/\{\+\+\([A-Z][^)]*\d{4}[^)]*\)\+\+\}/g, '');
|
|
38
|
+
// Clean up broken multi-part substitutions
|
|
39
|
+
text = text.replace(/\{~~(@[A-Za-z]+\d{4})~>[^~]+~~\}/g, '[$1]');
|
|
40
|
+
// Fix citations split across substitution boundaries
|
|
41
|
+
text = text.replace(/\{~~\[@~>[^~]*~~\}([A-Za-z]+\d{4})\]/g, '[@$1]');
|
|
42
|
+
// Clean up any remaining partial citations
|
|
43
|
+
text = text.replace(/\{~~;\s*@([A-Za-z]+\d{4})\]~>[^~]*~~\}/g, '; [@$1]');
|
|
44
|
+
// Remove rendered citation insertions (with Unicode support)
|
|
45
|
+
text = text.replace(/\{\+\+\(\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?(?:[;,]\s*\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?)*\)\+\+\}/gu, '');
|
|
46
|
+
text = text.replace(/\{\+\+\(\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?(?:[;,]\s*\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?)*\)\.\s*\+\+\}/gu, '');
|
|
47
|
+
// Trailing citation fragments
|
|
48
|
+
text = text.replace(/\{\+\+\d{4}[a-z]?(?:[;,]\s*(?:\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+)?\d{4}[a-z]?)*\)\.\s*\+\+\}/gu, '');
|
|
49
|
+
text = text.replace(/\{\+\+\d{4}[a-z]?(?:[;,]\s*(?:\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+)?\d{4}[a-z]?)*\)\s*\+\+\}/gu, '');
|
|
50
|
+
// Just year with closing paren
|
|
51
|
+
text = text.replace(/\{\+\+\d{4}[a-z]?\)\.\s*\+\+\}/g, '');
|
|
52
|
+
text = text.replace(/\{\+\+\d{4}[a-z]?\)\s*\+\+\}/g, '');
|
|
53
|
+
// Leading citation fragments
|
|
54
|
+
text = text.replace(/\{\+\+\(?\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s*\+\+\}/gu, '');
|
|
55
|
+
// Semicolon-separated fragments
|
|
56
|
+
text = text.replace(/\{\+\+[;,]\s*\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?\+\+\}/gu, '');
|
|
57
|
+
// Year ranges with authors
|
|
58
|
+
text = text.replace(/\{\+\+\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?(?:[;,]\s*\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?)*\)\s*\+\+\}/gu, '');
|
|
59
|
+
text = text.replace(/\{\+\+\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?(?:[;,]\s*\p{Lu}\p{L}*(?:\s+et\s+al\.?)?\s+\d{4}[a-z]?)*\)\.\s*\+\+\}/gu, '');
|
|
60
|
+
// Clean up double spaces and orphaned punctuation
|
|
61
|
+
text = text.replace(/ +/g, ' ');
|
|
62
|
+
text = text.replace(/\s+\./g, '.');
|
|
63
|
+
text = text.replace(/\s+,/g, ',');
|
|
64
|
+
// Final cleanup - remove empty annotations
|
|
65
|
+
text = text.replace(/\{~~\s*~>\s*~~\}/g, '');
|
|
66
|
+
text = text.replace(/\{\+\+\s*\+\+\}/g, '');
|
|
67
|
+
text = text.replace(/\{--\s*--\}/g, '');
|
|
68
|
+
return text;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Strip markdown syntax to get plain text
|
|
72
|
+
*/
|
|
73
|
+
function stripMarkdownSyntax(md) {
|
|
74
|
+
return md
|
|
75
|
+
.replace(/^---[\s\S]*?---\n*/m, '')
|
|
76
|
+
.replace(/^#{1,6}\s+/gm, '')
|
|
77
|
+
.replace(/(\*\*|__)(.*?)\1/g, '$2')
|
|
78
|
+
.replace(/(\*|_)(.*?)\1/g, '$2')
|
|
79
|
+
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
|
|
80
|
+
.replace(/!\[([^\]]*)\]\([^)]+\)/g, '')
|
|
81
|
+
.replace(/`([^`]+)`/g, '$1')
|
|
82
|
+
.replace(/```[\s\S]*?```/g, '')
|
|
83
|
+
.replace(/^>\s*/gm, '')
|
|
84
|
+
.replace(/^[-*_]{3,}\s*$/gm, '')
|
|
85
|
+
.replace(/^[\s]*[-*+]\s+/gm, '')
|
|
86
|
+
.replace(/^[\s]*\d+\.\s+/gm, '')
|
|
87
|
+
.replace(/\|/g, ' ')
|
|
88
|
+
.replace(/^[-:]+$/gm, '')
|
|
89
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
90
|
+
.trim();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Inject Word tables (extracted from XML) into pandoc text output
|
|
94
|
+
*/
|
|
95
|
+
function injectWordTables(pandocText, wordTables) {
|
|
96
|
+
if (!wordTables || wordTables.length === 0) {
|
|
97
|
+
return pandocText;
|
|
98
|
+
}
|
|
99
|
+
let result = pandocText;
|
|
100
|
+
for (const table of wordTables) {
|
|
101
|
+
const firstLine = table.markdown.split('\n')[0];
|
|
102
|
+
const headerCells = firstLine
|
|
103
|
+
.split('|')
|
|
104
|
+
.map((c) => c.trim())
|
|
105
|
+
.filter((c) => c.length > 0);
|
|
106
|
+
if (headerCells.length === 0)
|
|
107
|
+
continue;
|
|
108
|
+
const firstCell = headerCells[0];
|
|
109
|
+
const startIdx = result.indexOf(firstCell);
|
|
110
|
+
if (startIdx === -1)
|
|
111
|
+
continue;
|
|
112
|
+
const lastLine = table.markdown.split('\n').pop();
|
|
113
|
+
const lastCells = lastLine
|
|
114
|
+
.split('|')
|
|
115
|
+
.map((c) => c.trim())
|
|
116
|
+
.filter((c) => c.length > 0);
|
|
117
|
+
const lastCell = lastCells[lastCells.length - 1] || lastCells[0];
|
|
118
|
+
const endIdx = result.indexOf(lastCell, startIdx);
|
|
119
|
+
if (endIdx === -1)
|
|
120
|
+
continue;
|
|
121
|
+
let regionStart = result.lastIndexOf('\n\n', startIdx);
|
|
122
|
+
if (regionStart === -1)
|
|
123
|
+
regionStart = 0;
|
|
124
|
+
else
|
|
125
|
+
regionStart += 2;
|
|
126
|
+
let regionEnd = result.indexOf('\n\n', endIdx + lastCell.length);
|
|
127
|
+
if (regionEnd === -1)
|
|
128
|
+
regionEnd = result.length;
|
|
129
|
+
result = result.slice(0, regionStart) + table.markdown + '\n\n' + result.slice(regionEnd);
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Generate annotated markdown by diffing original MD against Word text
|
|
135
|
+
*/
|
|
136
|
+
export function generateAnnotatedDiff(originalMd, wordText, author = 'Reviewer') {
|
|
137
|
+
const normalizedOriginal = normalizeWhitespace(originalMd);
|
|
138
|
+
const normalizedWord = normalizeWhitespace(wordText);
|
|
139
|
+
const changes = diffWords(normalizedOriginal, normalizedWord);
|
|
140
|
+
let result = '';
|
|
141
|
+
for (const part of changes) {
|
|
142
|
+
if (part.added) {
|
|
143
|
+
result += `{++${part.value}++}`;
|
|
144
|
+
}
|
|
145
|
+
else if (part.removed) {
|
|
146
|
+
result += `{--${part.value}--}`;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
result += part.value;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Smart paragraph-level diff that preserves markdown structure
|
|
156
|
+
*/
|
|
157
|
+
export function generateSmartDiff(originalMd, wordText, author = 'Reviewer', options = {}) {
|
|
158
|
+
const { wordTables = [], imageRegistry = null } = options;
|
|
159
|
+
// Inject Word tables into pandoc output
|
|
160
|
+
let wordTextWithTables = injectWordTables(wordText, wordTables);
|
|
161
|
+
// Protect markdown tables
|
|
162
|
+
const { text: mdWithTablesProtected, tables } = protectTables(originalMd);
|
|
163
|
+
// Also protect tables in Word text
|
|
164
|
+
const { text: wordWithTablesProtected, tables: wordTableBlocks } = protectTables(wordTextWithTables);
|
|
165
|
+
// Protect images
|
|
166
|
+
const { text: mdWithImagesProtected, images: origImages } = protectImages(mdWithTablesProtected, imageRegistry);
|
|
167
|
+
const { text: wordWithImagesProtected, images: wordImages } = protectImages(wordWithTablesProtected, imageRegistry);
|
|
168
|
+
// Match Word images to original images
|
|
169
|
+
const imageMapping = matchWordImagesToOriginal(origImages, wordImages, imageRegistry);
|
|
170
|
+
// Replace Word image placeholders with matching original placeholders
|
|
171
|
+
let wordWithMappedImages = wordWithImagesProtected;
|
|
172
|
+
for (const [wordPlaceholder, origPlaceholder] of imageMapping) {
|
|
173
|
+
wordWithMappedImages = wordWithMappedImages.split(wordPlaceholder).join(origPlaceholder);
|
|
174
|
+
}
|
|
175
|
+
// Protect figure/table anchors
|
|
176
|
+
const { text: mdWithAnchorsProtected, anchors: figAnchors } = protectAnchors(mdWithImagesProtected);
|
|
177
|
+
// Protect cross-references
|
|
178
|
+
const { text: mdWithXrefsProtected, crossrefs } = protectCrossrefs(mdWithAnchorsProtected);
|
|
179
|
+
// Protect math
|
|
180
|
+
const { text: mdWithMathProtected, mathBlocks } = protectMath(mdWithXrefsProtected);
|
|
181
|
+
// Protect citations
|
|
182
|
+
const { text: mdProtected, citations } = protectCitations(mdWithMathProtected);
|
|
183
|
+
// Replace rendered elements in Word text
|
|
184
|
+
let wordProtected = wordWithMappedImages;
|
|
185
|
+
wordProtected = replaceRenderedMath(wordProtected, mathBlocks);
|
|
186
|
+
wordProtected = replaceRenderedCitations(wordProtected, citations.length);
|
|
187
|
+
// Split into paragraphs
|
|
188
|
+
const originalParas = mdProtected.split(/\n\n+/);
|
|
189
|
+
const wordParas = wordProtected.split(/\n\n+/);
|
|
190
|
+
const result = [];
|
|
191
|
+
// Try to match paragraphs intelligently
|
|
192
|
+
let wordIdx = 0;
|
|
193
|
+
for (let i = 0; i < originalParas.length; i++) {
|
|
194
|
+
const orig = originalParas[i] || '';
|
|
195
|
+
const { prefix: mdPrefix, content: origContent } = extractMarkdownPrefix(orig.split('\n')[0]);
|
|
196
|
+
// Find best matching word paragraph
|
|
197
|
+
let bestMatch = -1;
|
|
198
|
+
let bestScore = 0;
|
|
199
|
+
for (let j = wordIdx; j < Math.min(wordIdx + 3, wordParas.length); j++) {
|
|
200
|
+
const wordPara = wordParas[j] || '';
|
|
201
|
+
const origWords = new Set(origContent.toLowerCase().split(/\s+/));
|
|
202
|
+
const wordWords = wordPara.toLowerCase().split(/\s+/);
|
|
203
|
+
const common = wordWords.filter((w) => origWords.has(w)).length;
|
|
204
|
+
const score = common / Math.max(origWords.size, wordWords.length);
|
|
205
|
+
if (score > bestScore && score > 0.3) {
|
|
206
|
+
bestScore = score;
|
|
207
|
+
bestMatch = j;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (bestMatch === -1) {
|
|
211
|
+
if (mdPrefix && wordIdx < wordParas.length) {
|
|
212
|
+
const wordPara = wordParas[wordIdx];
|
|
213
|
+
if (wordPara.toLowerCase().includes(origContent.toLowerCase().slice(0, 20))) {
|
|
214
|
+
bestMatch = wordIdx;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (bestMatch >= 0) {
|
|
219
|
+
const word = wordParas[bestMatch];
|
|
220
|
+
const origStripped = stripMarkdownSyntax(orig);
|
|
221
|
+
const wordNormalized = normalizeWhitespace(word);
|
|
222
|
+
if (origStripped === wordNormalized) {
|
|
223
|
+
result.push(orig);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
const changes = diffWords(origStripped, wordNormalized);
|
|
227
|
+
let annotated = mdPrefix;
|
|
228
|
+
for (const part of changes) {
|
|
229
|
+
if (part.added) {
|
|
230
|
+
annotated += `{++${part.value}++}`;
|
|
231
|
+
}
|
|
232
|
+
else if (part.removed) {
|
|
233
|
+
annotated += `{--${part.value}--}`;
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
annotated += part.value;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
result.push(annotated);
|
|
240
|
+
}
|
|
241
|
+
wordIdx = bestMatch + 1;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// Paragraph deleted entirely
|
|
245
|
+
if (mdPrefix && mdPrefix.match(/^#{1,6}\s+/)) {
|
|
246
|
+
result.push(orig);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
result.push(`{--${orig}--}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Any remaining word paragraphs are additions
|
|
254
|
+
for (let j = wordIdx; j < wordParas.length; j++) {
|
|
255
|
+
const word = wordParas[j];
|
|
256
|
+
if (word.trim()) {
|
|
257
|
+
result.push(`{++${word}++}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// Restore protected content
|
|
261
|
+
let finalResult = result.join('\n\n');
|
|
262
|
+
finalResult = restoreCitations(finalResult, citations);
|
|
263
|
+
finalResult = restoreMath(finalResult, mathBlocks);
|
|
264
|
+
finalResult = restoreCrossrefs(finalResult, crossrefs);
|
|
265
|
+
finalResult = restoreAnchors(finalResult, figAnchors);
|
|
266
|
+
finalResult = restoreImages(finalResult, origImages);
|
|
267
|
+
finalResult = restoreImages(finalResult, wordImages);
|
|
268
|
+
finalResult = restoreTables(finalResult, tables);
|
|
269
|
+
finalResult = restoreTables(finalResult, wordTableBlocks);
|
|
270
|
+
return finalResult;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Clean up redundant adjacent annotations
|
|
274
|
+
*/
|
|
275
|
+
export function cleanupAnnotations(text) {
|
|
276
|
+
// Convert adjacent delete+insert to substitution
|
|
277
|
+
text = text.replace(/\{--(.+?)--\}\s*\{\+\+(.+?)\+\+\}/g, '{~~$1~>$2~~}');
|
|
278
|
+
// Also handle insert+delete
|
|
279
|
+
text = text.replace(/\{\+\+(.+?)\+\+\}\s*\{--(.+?)--\}/g, '{~~$2~>$1~~}');
|
|
280
|
+
// Fix malformed patterns
|
|
281
|
+
text = text.replace(/\{--([^}]+?)~>([^}]+?)~~\}/g, '{~~$1~>$2~~}');
|
|
282
|
+
// Fix malformed substitutions that got split
|
|
283
|
+
text = text.replace(/\{~~([^~]+)\s*--\}/g, '{--$1--}');
|
|
284
|
+
text = text.replace(/\{\+\+([^+]+)~~\}/g, '{++$1++}');
|
|
285
|
+
// Clean up empty annotations
|
|
286
|
+
text = text.replace(/\{--\s*--\}/g, '');
|
|
287
|
+
text = text.replace(/\{\+\+\s*\+\+\}/g, '');
|
|
288
|
+
// Clean up double spaces in prose, but preserve table formatting
|
|
289
|
+
const lines = text.split('\n');
|
|
290
|
+
let inTable = false;
|
|
291
|
+
const processedLines = lines.map((line, idx) => {
|
|
292
|
+
const isSeparator = /^[-]+(\s+[-]+)+\s*$/.test(line.trim());
|
|
293
|
+
const looksLikeTableRow = /\S+\s{2,}\S+/.test(line);
|
|
294
|
+
if (isSeparator) {
|
|
295
|
+
if (!inTable) {
|
|
296
|
+
inTable = true;
|
|
297
|
+
}
|
|
298
|
+
return line;
|
|
299
|
+
}
|
|
300
|
+
if (inTable) {
|
|
301
|
+
if (line.trim() === '') {
|
|
302
|
+
let lookAhead = idx + 1;
|
|
303
|
+
let foundTableContent = false;
|
|
304
|
+
let foundEndSeparator = false;
|
|
305
|
+
while (lookAhead < lines.length && lookAhead < idx + 20) {
|
|
306
|
+
const nextLine = lines[lookAhead].trim();
|
|
307
|
+
if (nextLine === '') {
|
|
308
|
+
lookAhead++;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (/^[-]+(\s+[-]+)+\s*$/.test(nextLine)) {
|
|
312
|
+
foundEndSeparator = true;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
if (/\S+\s{2,}\S+/.test(nextLine)) {
|
|
316
|
+
foundTableContent = true;
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
if (/^\*[^*]+\*\s*$/.test(nextLine)) {
|
|
320
|
+
foundTableContent = true;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
if (lines[lookAhead].startsWith(' ')) {
|
|
324
|
+
lookAhead++;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
if (foundTableContent || foundEndSeparator) {
|
|
330
|
+
return line;
|
|
331
|
+
}
|
|
332
|
+
inTable = false;
|
|
333
|
+
return line;
|
|
334
|
+
}
|
|
335
|
+
return line;
|
|
336
|
+
}
|
|
337
|
+
if (looksLikeTableRow) {
|
|
338
|
+
let nextIdx = idx + 1;
|
|
339
|
+
while (nextIdx < lines.length && lines[nextIdx].trim() === '') {
|
|
340
|
+
nextIdx++;
|
|
341
|
+
}
|
|
342
|
+
if (nextIdx < lines.length && /^[-]+(\s+[-]+)+\s*$/.test(lines[nextIdx].trim())) {
|
|
343
|
+
return line;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (line.trim().startsWith('|')) {
|
|
347
|
+
return line;
|
|
348
|
+
}
|
|
349
|
+
return line.replace(/ +/g, ' ');
|
|
350
|
+
});
|
|
351
|
+
text = processedLines.join('\n');
|
|
352
|
+
return text;
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=diff-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-engine.js","sourceRoot":"","sources":["../../lib/diff-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAU,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,yBAAyB,EACzB,aAAa,EACb,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAYjD,+CAA+C;AAC/C,YAAY;AACZ,+CAA+C;AAE/C;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,UAAkB;IACrE,0DAA0D;IAC1D,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAClD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;IAEtD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;IACzD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;IAE7D,+CAA+C;IAC/C,MAAM,eAAe,GAAG,cAAc,CA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,CAAC;AACd,CAAC"}
|
package/dist/lib/import.d.ts
CHANGED
|
@@ -1,77 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Import functionality - convert Word docs to annotated Markdown
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
docPosition: number;
|
|
15
|
-
docLength: number;
|
|
16
|
-
isEmpty: boolean;
|
|
17
|
-
}
|
|
18
|
-
interface CommentAnchorsResult {
|
|
19
|
-
anchors: Map<string, CommentAnchorData>;
|
|
20
|
-
fullDocText: string;
|
|
21
|
-
}
|
|
22
|
-
interface WordTable {
|
|
23
|
-
markdown: string;
|
|
24
|
-
rowCount: number;
|
|
25
|
-
colCount: number;
|
|
26
|
-
}
|
|
27
|
-
interface ExtractFromWordOptions {
|
|
28
|
-
mediaDir?: string;
|
|
29
|
-
skipMediaExtraction?: boolean;
|
|
30
|
-
}
|
|
31
|
-
interface ExtractMessage {
|
|
32
|
-
type: 'info' | 'warning';
|
|
33
|
-
message: string;
|
|
34
|
-
}
|
|
35
|
-
interface ExtractFromWordResult {
|
|
36
|
-
text: string;
|
|
37
|
-
comments: WordComment[];
|
|
38
|
-
anchors: Map<string, CommentAnchorData>;
|
|
39
|
-
messages: ExtractMessage[];
|
|
40
|
-
extractedMedia: string[];
|
|
41
|
-
tables: WordTable[];
|
|
42
|
-
hasTrackChanges: boolean;
|
|
43
|
-
trackChangeStats: {
|
|
44
|
-
insertions: number;
|
|
45
|
-
deletions: number;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
interface InsertCommentsOptions {
|
|
3
|
+
*
|
|
4
|
+
* Orchestration workflows + re-exports from extraction/diff/restore modules
|
|
5
|
+
*/
|
|
6
|
+
import type { WordComment, CommentAnchorData, WordTable } from './word-extraction.js';
|
|
7
|
+
export { extractFromWord, extractWordComments, extractCommentAnchors, extractHeadings, extractWordTables, } from './word-extraction.js';
|
|
8
|
+
export type { WordComment, TextNode, CommentAnchorData, CommentAnchorsResult, DocxHeading, WordTable, ParsedRow, ExtractFromWordOptions, ExtractMessage, ExtractFromWordResult, } from './word-extraction.js';
|
|
9
|
+
export { generateSmartDiff, generateAnnotatedDiff, cleanupAnnotations, fixCitationAnnotations, } from './diff-engine.js';
|
|
10
|
+
export type { GenerateSmartDiffOptions, } from './diff-engine.js';
|
|
11
|
+
export { restoreCrossrefFromWord, restoreImagesFromRegistry, parseVisibleComments, convertVisibleComments, } from './restore-references.js';
|
|
12
|
+
export type { RestoreCrossrefResult, RestoreImagesResult, } from './restore-references.js';
|
|
13
|
+
export interface InsertCommentsOptions {
|
|
49
14
|
quiet?: boolean;
|
|
50
15
|
sectionBoundary?: {
|
|
51
16
|
start: number;
|
|
52
17
|
end: number;
|
|
53
18
|
} | null;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
19
|
+
/**
|
|
20
|
+
* When true (default), comments wrap their anchor text in `[anchor]{.mark}`
|
|
21
|
+
* so the rebuilt docx restores the original Word comment range. When false,
|
|
22
|
+
* comments are inserted as standalone `{>>...<<}` blocks adjacent to the
|
|
23
|
+
* anchor — the prose stays byte-identical except for the inserted blocks.
|
|
24
|
+
*
|
|
25
|
+
* Set to false from `sync --comments-only` so a draft revised after the
|
|
26
|
+
* docx was sent for review keeps its prose intact, and so multiple
|
|
27
|
+
* comments sharing one anchor don't produce nested broken markup.
|
|
28
|
+
*/
|
|
29
|
+
wrapAnchor?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CommentWithPos {
|
|
32
|
+
id: string;
|
|
33
|
+
author: string;
|
|
66
34
|
text: string;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
35
|
+
date: string;
|
|
36
|
+
pos: number;
|
|
37
|
+
anchorText: string | null;
|
|
38
|
+
anchorEnd?: number;
|
|
39
|
+
isEmpty?: boolean;
|
|
40
|
+
strategy?: string;
|
|
41
|
+
}
|
|
42
|
+
export type { AnchorSearchResult } from './anchor-match.js';
|
|
43
|
+
export interface MarkdownPrefixResult {
|
|
44
|
+
prefix: string;
|
|
45
|
+
content: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ImportWordWithTrackChangesOptions {
|
|
71
48
|
mediaDir?: string;
|
|
72
49
|
projectDir?: string;
|
|
73
50
|
}
|
|
74
|
-
interface ImportWordWithTrackChangesResult {
|
|
51
|
+
export interface ImportWordWithTrackChangesResult {
|
|
75
52
|
text: string;
|
|
76
53
|
stats: {
|
|
77
54
|
insertions: number;
|
|
@@ -88,13 +65,13 @@ interface ImportWordWithTrackChangesResult {
|
|
|
88
65
|
extractedMedia: string[];
|
|
89
66
|
comments: WordComment[];
|
|
90
67
|
}
|
|
91
|
-
interface ImportFromWordOptions {
|
|
68
|
+
export interface ImportFromWordOptions {
|
|
92
69
|
author?: string;
|
|
93
70
|
sectionContent?: string;
|
|
94
71
|
figuresDir?: string;
|
|
95
72
|
wordTables?: WordTable[];
|
|
96
73
|
}
|
|
97
|
-
interface ImportFromWordResult {
|
|
74
|
+
export interface ImportFromWordResult {
|
|
98
75
|
annotated: string;
|
|
99
76
|
stats: {
|
|
100
77
|
insertions: number;
|
|
@@ -105,69 +82,19 @@ interface ImportFromWordResult {
|
|
|
105
82
|
};
|
|
106
83
|
extractedMedia: string[];
|
|
107
84
|
}
|
|
108
|
-
interface MovedFile {
|
|
85
|
+
export interface MovedFile {
|
|
109
86
|
from: string;
|
|
110
87
|
to: string;
|
|
111
88
|
name: string;
|
|
112
89
|
}
|
|
113
|
-
interface MoveExtractedMediaResult {
|
|
90
|
+
export interface MoveExtractedMediaResult {
|
|
114
91
|
moved: MovedFile[];
|
|
115
92
|
errors: string[];
|
|
116
93
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Extract comments directly from Word docx comments.xml
|
|
119
|
-
*/
|
|
120
|
-
export declare function extractWordComments(docxPath: string): Promise<WordComment[]>;
|
|
121
|
-
/**
|
|
122
|
-
* Extract comment anchor texts from document.xml with surrounding context
|
|
123
|
-
* Returns map of comment ID -> {anchor, before, after, docPosition, isEmpty} for better matching
|
|
124
|
-
* Also returns fullDocText for section boundary matching
|
|
125
|
-
*/
|
|
126
|
-
export declare function extractCommentAnchors(docxPath: string): Promise<CommentAnchorsResult>;
|
|
127
|
-
/**
|
|
128
|
-
* Extract tables directly from Word document XML and convert to markdown pipe tables
|
|
129
|
-
*/
|
|
130
|
-
export declare function extractWordTables(docxPath: string): Promise<WordTable[]>;
|
|
131
|
-
/**
|
|
132
|
-
* Extract text from Word document using pandoc with track changes preserved
|
|
133
|
-
*/
|
|
134
|
-
export declare function extractFromWord(docxPath: string, options?: ExtractFromWordOptions): Promise<ExtractFromWordResult>;
|
|
135
94
|
/**
|
|
136
95
|
* Insert comments into markdown text based on anchor texts with context
|
|
137
96
|
*/
|
|
138
97
|
export declare function insertCommentsIntoMarkdown(markdown: string, comments: WordComment[], anchors: Map<string, CommentAnchorData | string>, options?: InsertCommentsOptions): string;
|
|
139
|
-
/**
|
|
140
|
-
* Generate annotated markdown by diffing original MD against Word text
|
|
141
|
-
*/
|
|
142
|
-
export declare function generateAnnotatedDiff(originalMd: string, wordText: string, author?: string): string;
|
|
143
|
-
/**
|
|
144
|
-
* Smart paragraph-level diff that preserves markdown structure
|
|
145
|
-
*/
|
|
146
|
-
export declare function generateSmartDiff(originalMd: string, wordText: string, author?: string, options?: GenerateSmartDiffOptions): string;
|
|
147
|
-
/**
|
|
148
|
-
* Clean up redundant adjacent annotations
|
|
149
|
-
*/
|
|
150
|
-
export declare function cleanupAnnotations(text: string): string;
|
|
151
|
-
/**
|
|
152
|
-
* Parse visible comment markers from Word text
|
|
153
|
-
*/
|
|
154
|
-
export declare function parseVisibleComments(text: string): Array<{
|
|
155
|
-
author: string;
|
|
156
|
-
text: string;
|
|
157
|
-
position: number;
|
|
158
|
-
}>;
|
|
159
|
-
/**
|
|
160
|
-
* Convert visible comments to CriticMarkup format
|
|
161
|
-
*/
|
|
162
|
-
export declare function convertVisibleComments(text: string): string;
|
|
163
|
-
/**
|
|
164
|
-
* Restore pandoc-crossref figure/table references from Word-rendered format
|
|
165
|
-
*/
|
|
166
|
-
export declare function restoreCrossrefFromWord(text: string, projectDir: string, restoredLabels?: Set<string> | null): RestoreCrossrefResult;
|
|
167
|
-
/**
|
|
168
|
-
* Restore proper markdown image syntax from Word-extracted text using image registry
|
|
169
|
-
*/
|
|
170
|
-
export declare function restoreImagesFromRegistry(text: string, projectDir: string, restoredLabels?: Set<string> | null): RestoreImagesResult;
|
|
171
98
|
/**
|
|
172
99
|
* Import Word document with track changes directly as CriticMarkup
|
|
173
100
|
*/
|
|
@@ -180,5 +107,4 @@ export declare function importFromWord(docxPath: string, originalMdPath: string,
|
|
|
180
107
|
* Move extracted media files to a figures directory with better names
|
|
181
108
|
*/
|
|
182
109
|
export declare function moveExtractedMedia(mediaFiles: string[], figuresDir: string, prefix?: string): MoveExtractedMediaResult;
|
|
183
|
-
export {};
|
|
184
110
|
//# sourceMappingURL=import.d.ts.map
|
package/dist/lib/import.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../lib/import.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../lib/import.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,SAAS,EAEV,MAAM,sBAAsB,CAAC;AAgB9B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,WAAW,EACX,QAAQ,EACR,iBAAi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