regen.mde 0.2.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -16
- package/README.md +409 -295
- package/bin/build-corpus-editor.js +83 -81
- package/bin/build-corpus.js +41 -41
- package/bin/postinstall.js +259 -187
- package/bin/regen-mdeditor-install.js +27 -27
- package/bin/regen-mdeditor-uninstall.js +19 -19
- package/bin/validate-katex.js +93 -93
- package/desktop/BuildCorpusEditor/BuildCorpusBridge.cs +493 -270
- package/desktop/BuildCorpusEditor/BuildCorpusEditor.csproj +22 -22
- package/desktop/BuildCorpusEditor/EditorForm.cs +853 -540
- package/desktop/BuildCorpusEditor/Program.cs +85 -81
- package/desktop/BuildCorpusEditor/app.manifest +16 -16
- package/dist/release/regen-mde-0.8.0-win-x64.zip +0 -0
- package/dist/windows-editor/BuildCorpusEditor.dll +0 -0
- package/dist/windows-editor/BuildCorpusEditor.exe +0 -0
- package/dist/windows-editor/BuildCorpusEditor.pdb +0 -0
- package/dist/windows-editor/BuildCorpusEditor.runtimeconfig.json +1 -1
- package/dist/windows-editor/wwwroot/assets/index-C_VxJk4k.js +375 -0
- package/dist/windows-editor/wwwroot/assets/index-Wt9zSjIw.css +1 -0
- package/dist/windows-editor/wwwroot/index.html +22 -22
- package/editor-web/index.html +21 -21
- package/editor-web/src/main.jsx +1044 -399
- package/editor-web/src/styles.css +846 -602
- package/editor-web/vite.config.js +13 -13
- package/examples/build-corpus.config.example.json +21 -21
- package/installer/install-regen-mde.ps1 +214 -175
- package/installer/regen-mde.nsi +81 -81
- package/package.json +10 -6
- package/pyproject.toml +4 -3
- package/requirements.txt +5 -4
- package/scripts/build-windows-editor.ps1 +47 -47
- package/scripts/package-windows-editor.ps1 +90 -90
- package/scripts/release-dual.mjs +105 -0
- package/scripts/run-corpus.ps1 +28 -28
- package/scripts/run-editor-implementation-plane.ps1 +226 -203
- package/scripts/run-required-tests.ps1 +98 -98
- package/scripts/run-smoke.ps1 +28 -28
- package/src/build_corpus/__init__.py +1 -1
- package/src/build_corpus/docx_exporter.py +1055 -798
- package/src/build_corpus/equations.py +1345 -0
- package/src/build_corpus/exporter.py +1488 -1195
- package/src/build_corpus/frontmatter.py +302 -0
- package/src/build_corpus/ppt_exporter.py +543 -532
- package/src/build_corpus/templates/__init__.py +1 -1
- package/src/build_corpus/validate_assets.py +46 -46
- package/tools/audit_corpus.py +203 -203
- package/tools/collect_microsoft_word_templates.py +228 -228
- package/tools/collect_online_docx_corpus.py +272 -272
- package/tools/collect_online_pptx_corpus.py +252 -252
- package/tools/compare_pptx_inputs_outputs.py +87 -87
- package/tools/roundtrip_docx_corpus.py +171 -171
- package/dist/release/regen.mde-0.2.2-win-x64-setup.exe +0 -0
- package/dist/release/regen.mde-0.2.2-win-x64.zip +0 -0
- package/dist/windows-editor/wwwroot/assets/index-DjJ6xmhy.js +0 -326
- package/dist/windows-editor/wwwroot/assets/index-_dwMNNsm.css +0 -1
|
@@ -1,81 +1,83 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const path = require("node:path");
|
|
3
|
-
const { spawn } = require("node:child_process");
|
|
4
|
-
const fs = require("node:fs");
|
|
5
|
-
|
|
6
|
-
const root = path.resolve(__dirname, "..");
|
|
7
|
-
const callerCwd = process.cwd();
|
|
8
|
-
const candidates = [
|
|
9
|
-
path.join(root, "
|
|
10
|
-
path.join(root, "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
regen
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
--
|
|
28
|
-
--
|
|
29
|
-
--
|
|
30
|
-
--
|
|
31
|
-
--
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
console.error(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
|
|
6
|
+
const root = path.resolve(__dirname, "..");
|
|
7
|
+
const callerCwd = process.cwd();
|
|
8
|
+
const candidates = [
|
|
9
|
+
path.join(root, "BuildCorpusEditor.exe"),
|
|
10
|
+
path.join(root, "dist", "windows-editor", "BuildCorpusEditor.exe"),
|
|
11
|
+
path.join(root, "desktop", "BuildCorpusEditor", "bin", "Release", "net8.0-windows", "win-x64", "BuildCorpusEditor.exe"),
|
|
12
|
+
];
|
|
13
|
+
const exe = candidates.find((candidate) => fs.existsSync(candidate)) || candidates[0];
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
|
|
16
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
17
|
+
console.log(`regen-mde
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
regen-mde [document.md|document.docx] [options]
|
|
21
|
+
mdeditor [document.md|document.docx] [options]
|
|
22
|
+
regen-mdeditor [document.md|document.docx] [options]
|
|
23
|
+
regen-mdeditor [document.md|document.docx] [options]
|
|
24
|
+
build-corpus-editor [document.md|document.docx] [options]
|
|
25
|
+
|
|
26
|
+
Options:
|
|
27
|
+
--foreground, --visible Show the editor as an attached foreground process.
|
|
28
|
+
--background Launch hidden/offscreen for smoke checks.
|
|
29
|
+
--self-test Verify the editor bridge can open the document.
|
|
30
|
+
--document-self-test Open, edit, save Markdown, export Word, and reconvert.
|
|
31
|
+
--smoke-ui Run the hidden UI smoke test.
|
|
32
|
+
--out <dir> Output directory for document self-test.
|
|
33
|
+
--help, -h Show this help.
|
|
34
|
+
`);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const visible = args.includes("--foreground") || args.includes("--visible");
|
|
39
|
+
const background = args.includes("--background") || args.includes("--smoke-ui");
|
|
40
|
+
const launchArgs = normalizeLaunchArgs(args.filter((arg) => arg !== "--foreground" && arg !== "--visible"));
|
|
41
|
+
|
|
42
|
+
const child = spawn(exe, launchArgs, {
|
|
43
|
+
cwd: root,
|
|
44
|
+
stdio: "inherit",
|
|
45
|
+
windowsHide: background,
|
|
46
|
+
detached: background && !visible,
|
|
47
|
+
env: {
|
|
48
|
+
...process.env,
|
|
49
|
+
BUILD_CORPUS_ROOT: root,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
child.on("error", (error) => {
|
|
54
|
+
console.error(`Build Corpus Editor executable not found: ${exe}`);
|
|
55
|
+
console.error("Build it with: npm run editor:windows");
|
|
56
|
+
console.error(error.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
61
|
+
|
|
62
|
+
function normalizeLaunchArgs(rawArgs) {
|
|
63
|
+
const normalized = [];
|
|
64
|
+
for (let index = 0; index < rawArgs.length; index += 1) {
|
|
65
|
+
const arg = rawArgs[index];
|
|
66
|
+
if (arg === "--out" && index < rawArgs.length - 1) {
|
|
67
|
+
normalized.push(arg, resolveFromCaller(rawArgs[index + 1]));
|
|
68
|
+
index += 1;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (index === 0 && !arg.startsWith("--")) {
|
|
72
|
+
normalized.push(resolveFromCaller(arg));
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
normalized.push(arg);
|
|
76
|
+
}
|
|
77
|
+
return normalized;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function resolveFromCaller(value) {
|
|
81
|
+
if (!value || path.isAbsolute(value)) return value;
|
|
82
|
+
return path.resolve(callerCwd, value);
|
|
83
|
+
}
|
package/bin/build-corpus.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { spawnSync } = require("node:child_process");
|
|
3
|
-
const path = require("node:path");
|
|
4
|
-
|
|
5
|
-
const root = path.resolve(__dirname, "..");
|
|
6
|
-
const candidates = process.platform === "win32" ? ["py", "python"] : ["python3", "python"];
|
|
7
|
-
const env = { ...process.env };
|
|
8
|
-
env.PYTHONPATH = env.PYTHONPATH ? `${path.join(root, "src")}${path.delimiter}${env.PYTHONPATH}` : path.join(root, "src");
|
|
9
|
-
const args = process.argv.slice(2);
|
|
10
|
-
|
|
11
|
-
if (args[0] === "editor") {
|
|
12
|
-
const editor = path.join(root, "bin", "build-corpus-editor.js");
|
|
13
|
-
const result = spawnSync(process.execPath, [editor, ...args.slice(1)], {
|
|
14
|
-
stdio: "inherit",
|
|
15
|
-
cwd: root,
|
|
16
|
-
env: { ...env, BUILD_CORPUS_ROOT: root },
|
|
17
|
-
});
|
|
18
|
-
process.exit(result.status ?? 1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (process.platform === "win32" && args.includes("--uninstall-windows")) {
|
|
22
|
-
const result = spawnSync(process.execPath, [path.join(root, "bin", "postinstall.js"), "--uninstall"], {
|
|
23
|
-
stdio: "inherit",
|
|
24
|
-
cwd: root,
|
|
25
|
-
env,
|
|
26
|
-
});
|
|
27
|
-
process.exit(result.status ?? 1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let result = null;
|
|
31
|
-
for (const candidate of candidates) {
|
|
32
|
-
const args = candidate === "py"
|
|
33
|
-
? ["-3", "-m", "build_corpus.exporter", ...process.argv.slice(2)]
|
|
34
|
-
: ["-m", "build_corpus.exporter", ...process.argv.slice(2)];
|
|
35
|
-
result = spawnSync(candidate, args, { stdio: "inherit", cwd: root, env });
|
|
36
|
-
if (result.error && result.error.code === "ENOENT") continue;
|
|
37
|
-
process.exit(result.status ?? 1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.error("Build Corpus requires Python 3.10+ on PATH.");
|
|
41
|
-
process.exit(1);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
|
|
5
|
+
const root = path.resolve(__dirname, "..");
|
|
6
|
+
const candidates = process.platform === "win32" ? ["py", "python"] : ["python3", "python"];
|
|
7
|
+
const env = { ...process.env };
|
|
8
|
+
env.PYTHONPATH = env.PYTHONPATH ? `${path.join(root, "src")}${path.delimiter}${env.PYTHONPATH}` : path.join(root, "src");
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
if (args[0] === "editor") {
|
|
12
|
+
const editor = path.join(root, "bin", "build-corpus-editor.js");
|
|
13
|
+
const result = spawnSync(process.execPath, [editor, ...args.slice(1)], {
|
|
14
|
+
stdio: "inherit",
|
|
15
|
+
cwd: root,
|
|
16
|
+
env: { ...env, BUILD_CORPUS_ROOT: root },
|
|
17
|
+
});
|
|
18
|
+
process.exit(result.status ?? 1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (process.platform === "win32" && args.includes("--uninstall-windows")) {
|
|
22
|
+
const result = spawnSync(process.execPath, [path.join(root, "bin", "postinstall.js"), "--uninstall"], {
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
cwd: root,
|
|
25
|
+
env,
|
|
26
|
+
});
|
|
27
|
+
process.exit(result.status ?? 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let result = null;
|
|
31
|
+
for (const candidate of candidates) {
|
|
32
|
+
const args = candidate === "py"
|
|
33
|
+
? ["-3", "-m", "build_corpus.exporter", ...process.argv.slice(2)]
|
|
34
|
+
: ["-m", "build_corpus.exporter", ...process.argv.slice(2)];
|
|
35
|
+
result = spawnSync(candidate, args, { stdio: "inherit", cwd: root, env });
|
|
36
|
+
if (result.error && result.error.code === "ENOENT") continue;
|
|
37
|
+
process.exit(result.status ?? 1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.error("Build Corpus requires Python 3.10+ on PATH.");
|
|
41
|
+
process.exit(1);
|