regen.mde 0.8.0 → 0.8.2

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 (45) hide show
  1. package/LICENSE +16 -16
  2. package/README.md +2 -1
  3. package/bin/build-corpus-editor.js +83 -83
  4. package/bin/build-corpus.js +41 -41
  5. package/bin/regen-mdeditor-install.js +27 -27
  6. package/bin/regen-mdeditor-uninstall.js +19 -19
  7. package/bin/validate-katex.js +93 -93
  8. package/desktop/BuildCorpusEditor/BuildCorpusEditor.csproj +22 -22
  9. package/desktop/BuildCorpusEditor/EditorForm.cs +48 -0
  10. package/desktop/BuildCorpusEditor/app.manifest +16 -16
  11. package/dist/release/{regen-mde-0.8.0-win-x64.zip → regen-mde-0.6.1-win-x64.zip} +0 -0
  12. package/dist/release/regen-mde-0.8.2-win-x64.zip +0 -0
  13. package/dist/windows-editor/BuildCorpusEditor.dll +0 -0
  14. package/dist/windows-editor/BuildCorpusEditor.exe +0 -0
  15. package/dist/windows-editor/BuildCorpusEditor.pdb +0 -0
  16. package/dist/windows-editor/wwwroot/assets/{index-C_VxJk4k.js → index-BB0sbZaD.js} +107 -107
  17. package/dist/windows-editor/wwwroot/assets/index-CtOv7qsC.css +1 -0
  18. package/dist/windows-editor/wwwroot/index.html +22 -22
  19. package/editor-web/index.html +21 -21
  20. package/editor-web/src/main.jsx +91 -53
  21. package/editor-web/src/styles.css +65 -1
  22. package/editor-web/vite.config.js +13 -13
  23. package/examples/build-corpus.config.example.json +21 -21
  24. package/installer/install-regen-mde.ps1 +214 -214
  25. package/installer/regen-mde.nsi +81 -81
  26. package/package.json +1 -1
  27. package/pyproject.toml +1 -1
  28. package/scripts/build-windows-editor.ps1 +47 -47
  29. package/scripts/package-windows-editor.ps1 +90 -90
  30. package/scripts/run-corpus.ps1 +28 -28
  31. package/scripts/run-editor-implementation-plane.ps1 +226 -226
  32. package/scripts/run-required-tests.ps1 +98 -98
  33. package/scripts/run-smoke.ps1 +28 -28
  34. package/src/build_corpus/__init__.py +3 -3
  35. package/src/build_corpus/docx_exporter.py +10 -4
  36. package/src/build_corpus/equations.py +1345 -1345
  37. package/src/build_corpus/templates/__init__.py +1 -1
  38. package/src/build_corpus/validate_assets.py +46 -46
  39. package/tools/audit_corpus.py +203 -203
  40. package/tools/collect_microsoft_word_templates.py +228 -228
  41. package/tools/collect_online_docx_corpus.py +272 -272
  42. package/tools/collect_online_pptx_corpus.py +252 -252
  43. package/tools/compare_pptx_inputs_outputs.py +87 -87
  44. package/tools/roundtrip_docx_corpus.py +171 -171
  45. package/dist/windows-editor/wwwroot/assets/index-Wt9zSjIw.css +0 -1
@@ -1,214 +1,214 @@
1
- [CmdletBinding()]
2
- param(
3
- [string]$PackageRoot = "",
4
- [string]$InstallDir = "$env:LOCALAPPDATA\Programs\regen-mde"
5
- )
6
-
7
- $ErrorActionPreference = "Stop"
8
-
9
- if ([string]::IsNullOrWhiteSpace($PackageRoot)) {
10
- $PackageApp = Join-Path $PSScriptRoot "app"
11
- if (Test-Path -LiteralPath (Join-Path $PackageApp "BuildCorpusEditor.exe")) {
12
- $PackageRoot = $PackageApp
13
- } else {
14
- $PackageRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
15
- }
16
- }
17
-
18
- $ProductName = "regen-mde"
19
- $LegacyProductNames = @("Manuscript Forge", "Regen.MDeditor")
20
- $AppSource = if (Test-Path -LiteralPath (Join-Path $PackageRoot "BuildCorpusEditor.exe")) {
21
- $PackageRoot
22
- } else {
23
- Join-Path $PackageRoot "dist\windows-editor"
24
- }
25
- $AppExe = Join-Path $AppSource "BuildCorpusEditor.exe"
26
- $StartMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
27
- $ShortcutPath = Join-Path $StartMenuDir "$ProductName.lnk"
28
- $UninstallShortcutPath = Join-Path $StartMenuDir "Uninstall $ProductName.lnk"
29
- $LegacyInstallDir = Join-Path $env:LOCALAPPDATA "Programs\Manuscript Forge"
30
- $LegacyInstallDir2 = Join-Path $env:LOCALAPPDATA "Programs\Regen.MDeditor"
31
-
32
- if (-not (Test-Path -LiteralPath $AppExe)) {
33
- throw "Package is missing BuildCorpusEditor.exe"
34
- }
35
-
36
- function Remove-FileVerb {
37
- param(
38
- [string]$Extension,
39
- [string]$Verb
40
- )
41
- Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb" -Recurse -Force -ErrorAction SilentlyContinue
42
- }
43
-
44
- Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
45
- foreach ($legacyProductName in $LegacyProductNames) {
46
- Remove-Item -LiteralPath (Join-Path $StartMenuDir "$legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
47
- Remove-Item -LiteralPath (Join-Path $StartMenuDir "Uninstall $legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
48
- }
49
- Remove-Item -LiteralPath $ShortcutPath -Force -ErrorAction SilentlyContinue
50
- Remove-Item -LiteralPath $UninstallShortcutPath -Force -ErrorAction SilentlyContinue
51
- foreach ($ext in @(".md", ".docx", ".pptx", ".ppt")) {
52
- foreach ($verb in @("ManuscriptForgeOpen", "BuildCorpusOpenEditor", "RegenMDEditorOpen", "BuildCorpusToMarkdown", "BuildCorpusToWord", "BuildCorpusInlineImages")) {
53
- Remove-FileVerb -Extension $ext -Verb $verb
54
- }
55
- }
56
- Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\BuildCorpusFolderToMarkdown" -Recurse -Force -ErrorAction SilentlyContinue
57
- if ((Test-Path -LiteralPath $LegacyInstallDir) -and ($LegacyInstallDir -ne $InstallDir)) {
58
- Remove-Item -LiteralPath $LegacyInstallDir -Recurse -Force -ErrorAction SilentlyContinue
59
- }
60
- if ((Test-Path -LiteralPath $LegacyInstallDir2) -and ($LegacyInstallDir2 -ne $InstallDir)) {
61
- Remove-Item -LiteralPath $LegacyInstallDir2 -Recurse -Force -ErrorAction SilentlyContinue
62
- }
63
-
64
- New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
65
- foreach ($item in @("wwwroot", "runtimes")) {
66
- Remove-Item -LiteralPath (Join-Path $InstallDir $item) -Recurse -Force -ErrorAction SilentlyContinue
67
- }
68
- foreach ($pattern in @("BuildCorpusEditor.*", "Microsoft.Web.WebView2.*", "WebView2Loader.dll")) {
69
- Get-ChildItem -LiteralPath $InstallDir -Filter $pattern -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
70
- }
71
- Copy-Item -Path (Join-Path $AppSource "*") -Destination $InstallDir -Recurse -Force
72
- foreach ($item in @("bin", "src")) {
73
- $sourcePath = Join-Path $PackageRoot $item
74
- if (Test-Path -LiteralPath $sourcePath) {
75
- $destinationPath = Join-Path $InstallDir $item
76
- Remove-Item -LiteralPath $destinationPath -Recurse -Force -ErrorAction SilentlyContinue
77
- Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Recurse -Force
78
- }
79
- }
80
- foreach ($item in @("requirements.txt", "pyproject.toml", "package.json", "package-lock.json")) {
81
- $sourcePath = Join-Path $PackageRoot $item
82
- if (Test-Path -LiteralPath $sourcePath) {
83
- Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Force
84
- }
85
- }
86
-
87
- $InstalledExe = Join-Path $InstallDir "BuildCorpusEditor.exe"
88
- $UninstallScript = Join-Path $InstallDir "uninstall-regen-mde.ps1"
89
-
90
- if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
91
- throw "Node.js is required on PATH for DOCX/Markdown conversion."
92
- }
93
- $NodeExe = (Get-Command node -ErrorAction Stop).Source
94
-
95
- $requirements = Join-Path $InstallDir "requirements.txt"
96
- $pythonReady = $false
97
- foreach ($candidate in @("py", "python")) {
98
- if (-not (Get-Command $candidate -ErrorAction SilentlyContinue)) { continue }
99
- if ($candidate -eq "py") {
100
- & py -3 -c "import omml2latex, boto3, PIL, docx" 2>$null
101
- } else {
102
- & python -c "import omml2latex, boto3, PIL, docx" 2>$null
103
- }
104
- if ($LASTEXITCODE -eq 0) {
105
- $pythonReady = $true
106
- break
107
- }
108
- }
109
-
110
- if (-not $pythonReady) {
111
- Write-Warning "Python conversion dependencies are not already installed. Install them later with: py -3 -m pip install -r `"$requirements`""
112
- }
113
-
114
- New-Item -ItemType Directory -Force -Path $StartMenuDir | Out-Null
115
- $shell = New-Object -ComObject WScript.Shell
116
- $shortcut = $shell.CreateShortcut($ShortcutPath)
117
- $shortcut.TargetPath = $InstalledExe
118
- $shortcut.WorkingDirectory = $InstallDir
119
- $shortcut.IconLocation = "$InstalledExe,0"
120
- $shortcut.Description = "$ProductName Word and Markdown editor"
121
- $shortcut.Save()
122
-
123
- function Set-FileVerb {
124
- param(
125
- [string]$Extension,
126
- [string]$Verb,
127
- [string]$Label,
128
- [string]$Command
129
- )
130
- $key = "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb"
131
- $commandKey = Join-Path $key "command"
132
- New-Item -Path $commandKey -Force | Out-Null
133
- New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
134
- New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
135
- [Microsoft.Win32.Registry]::SetValue(
136
- "HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb\command",
137
- "",
138
- $Command,
139
- [Microsoft.Win32.RegistryValueKind]::String)
140
- }
141
-
142
- function Set-FolderVerb {
143
- param(
144
- [string]$Verb,
145
- [string]$Label,
146
- [string]$Command
147
- )
148
- $key = "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\$Verb"
149
- $commandKey = Join-Path $key "command"
150
- New-Item -Path $commandKey -Force | Out-Null
151
- New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
152
- New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
153
- [Microsoft.Win32.Registry]::SetValue(
154
- "HKEY_CURRENT_USER\Software\Classes\Directory\shell\$Verb\command",
155
- "",
156
- $Command,
157
- [Microsoft.Win32.RegistryValueKind]::String)
158
- }
159
-
160
- Set-FileVerb -Extension ".md" -Verb "RegenMDEditorOpen" -Label "Open in regen-mde" -Command "`"$InstalledExe`" `"%1`""
161
- Set-FileVerb -Extension ".docx" -Verb "RegenMDEditorOpen" -Label "Open in regen-mde" -Command "`"$InstalledExe`" `"%1`""
162
- Set-FileVerb -Extension ".docx" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
163
- Set-FileVerb -Extension ".pptx" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
164
- Set-FileVerb -Extension ".ppt" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
165
- Set-FileVerb -Extension ".md" -Verb "BuildCorpusToWord" -Label "Convert to Word" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --to word --out-same-dir"
166
- Set-FileVerb -Extension ".md" -Verb "BuildCorpusInlineImages" -Label "Inline Markdown Images" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --inline-images"
167
- Set-FolderVerb -Verb "BuildCorpusFolderToMarkdown" -Label "Convert Documents to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%V`" --out-same-dir"
168
- New-Item -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Force | Out-Null
169
- New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md" -Name "Content Type" -Value "text/markdown" -PropertyType String -Force | Out-Null
170
- New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Name "NullFile" -Value "" -PropertyType String -Force | Out-Null
171
-
172
- $uninstall = @"
173
- `$ErrorActionPreference = "Stop"
174
- `$ProductName = "regen-mde"
175
- `$InstallDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
176
- `$StartMenuDir = Join-Path `$env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
177
- Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
178
- Remove-Item -LiteralPath (Join-Path `$StartMenuDir "`$ProductName.lnk") -Force -ErrorAction SilentlyContinue
179
- Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall `$ProductName.lnk") -Force -ErrorAction SilentlyContinue
180
- Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
181
- Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Manuscript Forge.lnk") -Force -ErrorAction SilentlyContinue
182
- Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
183
- foreach (`$ext in @(".md", ".docx", ".pptx", ".ppt")) {
184
- foreach (`$verb in @("RegenMDEditorOpen", "BuildCorpusToMarkdown", "BuildCorpusToWord", "BuildCorpusInlineImages", "ManuscriptForgeOpen", "BuildCorpusOpenEditor")) {
185
- Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\`$ext\shell\`$verb" -Recurse -Force -ErrorAction SilentlyContinue
186
- }
187
- }
188
- Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\BuildCorpusFolderToMarkdown" -Recurse -Force -ErrorAction SilentlyContinue
189
- Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Recurse -Force -ErrorAction SilentlyContinue
190
- for (`$i = 0; `$i -lt 10; `$i++) {
191
- Start-Sleep -Milliseconds 250
192
- try {
193
- Remove-Item -LiteralPath `$InstallDir -Recurse -Force
194
- break
195
- } catch {
196
- if (`$i -eq 9) { throw }
197
- }
198
- }
199
- Write-Host "`$ProductName removed."
200
- "@
201
- Set-Content -LiteralPath $UninstallScript -Value $uninstall -Encoding UTF8
202
-
203
- $uninstallShortcut = $shell.CreateShortcut($UninstallShortcutPath)
204
- $uninstallShortcut.TargetPath = "powershell.exe"
205
- $uninstallShortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$UninstallScript`""
206
- $uninstallShortcut.WorkingDirectory = $InstallDir
207
- $uninstallShortcut.IconLocation = "$InstalledExe,0"
208
- $uninstallShortcut.Description = "Uninstall $ProductName"
209
- $uninstallShortcut.Save()
210
-
211
- Write-Host "$ProductName installed."
212
- Write-Host "InstallDir=$InstallDir"
213
- Write-Host "Shortcut=$ShortcutPath"
214
- Write-Host "Executable=$InstalledExe"
1
+ [CmdletBinding()]
2
+ param(
3
+ [string]$PackageRoot = "",
4
+ [string]$InstallDir = "$env:LOCALAPPDATA\Programs\regen-mde"
5
+ )
6
+
7
+ $ErrorActionPreference = "Stop"
8
+
9
+ if ([string]::IsNullOrWhiteSpace($PackageRoot)) {
10
+ $PackageApp = Join-Path $PSScriptRoot "app"
11
+ if (Test-Path -LiteralPath (Join-Path $PackageApp "BuildCorpusEditor.exe")) {
12
+ $PackageRoot = $PackageApp
13
+ } else {
14
+ $PackageRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
15
+ }
16
+ }
17
+
18
+ $ProductName = "regen-mde"
19
+ $LegacyProductNames = @("Manuscript Forge", "Regen.MDeditor")
20
+ $AppSource = if (Test-Path -LiteralPath (Join-Path $PackageRoot "BuildCorpusEditor.exe")) {
21
+ $PackageRoot
22
+ } else {
23
+ Join-Path $PackageRoot "dist\windows-editor"
24
+ }
25
+ $AppExe = Join-Path $AppSource "BuildCorpusEditor.exe"
26
+ $StartMenuDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
27
+ $ShortcutPath = Join-Path $StartMenuDir "$ProductName.lnk"
28
+ $UninstallShortcutPath = Join-Path $StartMenuDir "Uninstall $ProductName.lnk"
29
+ $LegacyInstallDir = Join-Path $env:LOCALAPPDATA "Programs\Manuscript Forge"
30
+ $LegacyInstallDir2 = Join-Path $env:LOCALAPPDATA "Programs\Regen.MDeditor"
31
+
32
+ if (-not (Test-Path -LiteralPath $AppExe)) {
33
+ throw "Package is missing BuildCorpusEditor.exe"
34
+ }
35
+
36
+ function Remove-FileVerb {
37
+ param(
38
+ [string]$Extension,
39
+ [string]$Verb
40
+ )
41
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb" -Recurse -Force -ErrorAction SilentlyContinue
42
+ }
43
+
44
+ Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
45
+ foreach ($legacyProductName in $LegacyProductNames) {
46
+ Remove-Item -LiteralPath (Join-Path $StartMenuDir "$legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
47
+ Remove-Item -LiteralPath (Join-Path $StartMenuDir "Uninstall $legacyProductName.lnk") -Force -ErrorAction SilentlyContinue
48
+ }
49
+ Remove-Item -LiteralPath $ShortcutPath -Force -ErrorAction SilentlyContinue
50
+ Remove-Item -LiteralPath $UninstallShortcutPath -Force -ErrorAction SilentlyContinue
51
+ foreach ($ext in @(".md", ".docx", ".pptx", ".ppt")) {
52
+ foreach ($verb in @("ManuscriptForgeOpen", "BuildCorpusOpenEditor", "RegenMDEditorOpen", "BuildCorpusToMarkdown", "BuildCorpusToWord", "BuildCorpusInlineImages")) {
53
+ Remove-FileVerb -Extension $ext -Verb $verb
54
+ }
55
+ }
56
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\BuildCorpusFolderToMarkdown" -Recurse -Force -ErrorAction SilentlyContinue
57
+ if ((Test-Path -LiteralPath $LegacyInstallDir) -and ($LegacyInstallDir -ne $InstallDir)) {
58
+ Remove-Item -LiteralPath $LegacyInstallDir -Recurse -Force -ErrorAction SilentlyContinue
59
+ }
60
+ if ((Test-Path -LiteralPath $LegacyInstallDir2) -and ($LegacyInstallDir2 -ne $InstallDir)) {
61
+ Remove-Item -LiteralPath $LegacyInstallDir2 -Recurse -Force -ErrorAction SilentlyContinue
62
+ }
63
+
64
+ New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
65
+ foreach ($item in @("wwwroot", "runtimes")) {
66
+ Remove-Item -LiteralPath (Join-Path $InstallDir $item) -Recurse -Force -ErrorAction SilentlyContinue
67
+ }
68
+ foreach ($pattern in @("BuildCorpusEditor.*", "Microsoft.Web.WebView2.*", "WebView2Loader.dll")) {
69
+ Get-ChildItem -LiteralPath $InstallDir -Filter $pattern -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
70
+ }
71
+ Copy-Item -Path (Join-Path $AppSource "*") -Destination $InstallDir -Recurse -Force
72
+ foreach ($item in @("bin", "src")) {
73
+ $sourcePath = Join-Path $PackageRoot $item
74
+ if (Test-Path -LiteralPath $sourcePath) {
75
+ $destinationPath = Join-Path $InstallDir $item
76
+ Remove-Item -LiteralPath $destinationPath -Recurse -Force -ErrorAction SilentlyContinue
77
+ Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Recurse -Force
78
+ }
79
+ }
80
+ foreach ($item in @("requirements.txt", "pyproject.toml", "package.json", "package-lock.json")) {
81
+ $sourcePath = Join-Path $PackageRoot $item
82
+ if (Test-Path -LiteralPath $sourcePath) {
83
+ Copy-Item -LiteralPath $sourcePath -Destination $InstallDir -Force
84
+ }
85
+ }
86
+
87
+ $InstalledExe = Join-Path $InstallDir "BuildCorpusEditor.exe"
88
+ $UninstallScript = Join-Path $InstallDir "uninstall-regen-mde.ps1"
89
+
90
+ if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
91
+ throw "Node.js is required on PATH for DOCX/Markdown conversion."
92
+ }
93
+ $NodeExe = (Get-Command node -ErrorAction Stop).Source
94
+
95
+ $requirements = Join-Path $InstallDir "requirements.txt"
96
+ $pythonReady = $false
97
+ foreach ($candidate in @("py", "python")) {
98
+ if (-not (Get-Command $candidate -ErrorAction SilentlyContinue)) { continue }
99
+ if ($candidate -eq "py") {
100
+ & py -3 -c "import omml2latex, boto3, PIL, docx" 2>$null
101
+ } else {
102
+ & python -c "import omml2latex, boto3, PIL, docx" 2>$null
103
+ }
104
+ if ($LASTEXITCODE -eq 0) {
105
+ $pythonReady = $true
106
+ break
107
+ }
108
+ }
109
+
110
+ if (-not $pythonReady) {
111
+ Write-Warning "Python conversion dependencies are not already installed. Install them later with: py -3 -m pip install -r `"$requirements`""
112
+ }
113
+
114
+ New-Item -ItemType Directory -Force -Path $StartMenuDir | Out-Null
115
+ $shell = New-Object -ComObject WScript.Shell
116
+ $shortcut = $shell.CreateShortcut($ShortcutPath)
117
+ $shortcut.TargetPath = $InstalledExe
118
+ $shortcut.WorkingDirectory = $InstallDir
119
+ $shortcut.IconLocation = "$InstalledExe,0"
120
+ $shortcut.Description = "$ProductName Word and Markdown editor"
121
+ $shortcut.Save()
122
+
123
+ function Set-FileVerb {
124
+ param(
125
+ [string]$Extension,
126
+ [string]$Verb,
127
+ [string]$Label,
128
+ [string]$Command
129
+ )
130
+ $key = "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb"
131
+ $commandKey = Join-Path $key "command"
132
+ New-Item -Path $commandKey -Force | Out-Null
133
+ New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
134
+ New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
135
+ [Microsoft.Win32.Registry]::SetValue(
136
+ "HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\$Extension\shell\$Verb\command",
137
+ "",
138
+ $Command,
139
+ [Microsoft.Win32.RegistryValueKind]::String)
140
+ }
141
+
142
+ function Set-FolderVerb {
143
+ param(
144
+ [string]$Verb,
145
+ [string]$Label,
146
+ [string]$Command
147
+ )
148
+ $key = "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\$Verb"
149
+ $commandKey = Join-Path $key "command"
150
+ New-Item -Path $commandKey -Force | Out-Null
151
+ New-ItemProperty -Path $key -Name "MUIVerb" -Value $Label -PropertyType String -Force | Out-Null
152
+ New-ItemProperty -Path $key -Name "Icon" -Value $InstalledExe -PropertyType ExpandString -Force | Out-Null
153
+ [Microsoft.Win32.Registry]::SetValue(
154
+ "HKEY_CURRENT_USER\Software\Classes\Directory\shell\$Verb\command",
155
+ "",
156
+ $Command,
157
+ [Microsoft.Win32.RegistryValueKind]::String)
158
+ }
159
+
160
+ Set-FileVerb -Extension ".md" -Verb "RegenMDEditorOpen" -Label "Open in regen-mde" -Command "`"$InstalledExe`" `"%1`""
161
+ Set-FileVerb -Extension ".docx" -Verb "RegenMDEditorOpen" -Label "Open in regen-mde" -Command "`"$InstalledExe`" `"%1`""
162
+ Set-FileVerb -Extension ".docx" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
163
+ Set-FileVerb -Extension ".pptx" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
164
+ Set-FileVerb -Extension ".ppt" -Verb "BuildCorpusToMarkdown" -Label "Convert to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --out-same-dir"
165
+ Set-FileVerb -Extension ".md" -Verb "BuildCorpusToWord" -Label "Convert to Word" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --to word --out-same-dir"
166
+ Set-FileVerb -Extension ".md" -Verb "BuildCorpusInlineImages" -Label "Inline Markdown Images" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%1`" --inline-images"
167
+ Set-FolderVerb -Verb "BuildCorpusFolderToMarkdown" -Label "Convert Documents to Markdown" -Command "`"$NodeExe`" `"$InstallDir\bin\build-corpus.js`" `"%V`" --out-same-dir"
168
+ New-Item -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Force | Out-Null
169
+ New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md" -Name "Content Type" -Value "text/markdown" -PropertyType String -Force | Out-Null
170
+ New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Name "NullFile" -Value "" -PropertyType String -Force | Out-Null
171
+
172
+ $uninstall = @"
173
+ `$ErrorActionPreference = "Stop"
174
+ `$ProductName = "regen-mde"
175
+ `$InstallDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
176
+ `$StartMenuDir = Join-Path `$env:APPDATA "Microsoft\Windows\Start Menu\Programs\LIFE AI"
177
+ Get-Process BuildCorpusEditor -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
178
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "`$ProductName.lnk") -Force -ErrorAction SilentlyContinue
179
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall `$ProductName.lnk") -Force -ErrorAction SilentlyContinue
180
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
181
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Manuscript Forge.lnk") -Force -ErrorAction SilentlyContinue
182
+ Remove-Item -LiteralPath (Join-Path `$StartMenuDir "Uninstall Regen.MDeditor.lnk") -Force -ErrorAction SilentlyContinue
183
+ foreach (`$ext in @(".md", ".docx", ".pptx", ".ppt")) {
184
+ foreach (`$verb in @("RegenMDEditorOpen", "BuildCorpusToMarkdown", "BuildCorpusToWord", "BuildCorpusInlineImages", "ManuscriptForgeOpen", "BuildCorpusOpenEditor")) {
185
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\`$ext\shell\`$verb" -Recurse -Force -ErrorAction SilentlyContinue
186
+ }
187
+ }
188
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\Directory\shell\BuildCorpusFolderToMarkdown" -Recurse -Force -ErrorAction SilentlyContinue
189
+ Remove-Item -LiteralPath "Registry::HKEY_CURRENT_USER\Software\Classes\.md\ShellNew" -Recurse -Force -ErrorAction SilentlyContinue
190
+ for (`$i = 0; `$i -lt 10; `$i++) {
191
+ Start-Sleep -Milliseconds 250
192
+ try {
193
+ Remove-Item -LiteralPath `$InstallDir -Recurse -Force
194
+ break
195
+ } catch {
196
+ if (`$i -eq 9) { throw }
197
+ }
198
+ }
199
+ Write-Host "`$ProductName removed."
200
+ "@
201
+ Set-Content -LiteralPath $UninstallScript -Value $uninstall -Encoding UTF8
202
+
203
+ $uninstallShortcut = $shell.CreateShortcut($UninstallShortcutPath)
204
+ $uninstallShortcut.TargetPath = "powershell.exe"
205
+ $uninstallShortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$UninstallScript`""
206
+ $uninstallShortcut.WorkingDirectory = $InstallDir
207
+ $uninstallShortcut.IconLocation = "$InstalledExe,0"
208
+ $uninstallShortcut.Description = "Uninstall $ProductName"
209
+ $uninstallShortcut.Save()
210
+
211
+ Write-Host "$ProductName installed."
212
+ Write-Host "InstallDir=$InstallDir"
213
+ Write-Host "Shortcut=$ShortcutPath"
214
+ Write-Host "Executable=$InstalledExe"
@@ -1,81 +1,81 @@
1
- !ifndef VERSION
2
- !define VERSION "0.2.1"
3
- !endif
4
- !ifndef APP_SOURCE
5
- !error "APP_SOURCE must point to the staged app directory"
6
- !endif
7
- !ifndef OUT_FILE
8
- !define OUT_FILE "regen-mde-${VERSION}-win-x64-setup.exe"
9
- !endif
10
-
11
- Unicode true
12
- Name "regen-mde"
13
- OutFile "${OUT_FILE}"
14
- InstallDir "$LOCALAPPDATA\Programs\regen-mde"
15
- RequestExecutionLevel user
16
- SetCompressor /SOLID lzma
17
-
18
- !include LogicLib.nsh
19
-
20
- Var StartMenuDir
21
-
22
- Function .onInit
23
- StrCpy $StartMenuDir "$SMPROGRAMS\LIFE AI"
24
- FunctionEnd
25
-
26
- Section "Install"
27
- SetShellVarContext current
28
-
29
- ; Remove earlier app identities and npm-era shell verbs before installing.
30
- RMDir /r "$LOCALAPPDATA\Programs\Manuscript Forge"
31
- RMDir /r "$LOCALAPPDATA\Programs\Regen.MDeditor"
32
- Delete "$SMPROGRAMS\LIFE AI\Manuscript Forge.lnk"
33
- Delete "$SMPROGRAMS\LIFE AI\Regen.MDeditor.lnk"
34
- Delete "$SMPROGRAMS\LIFE AI\Uninstall Regen.MDeditor.lnk"
35
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
36
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
37
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
38
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
39
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
40
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
41
-
42
- SetOutPath "$INSTDIR"
43
- File /r "${APP_SOURCE}\*.*"
44
-
45
- WriteUninstaller "$INSTDIR\uninstall.exe"
46
- CreateDirectory "$StartMenuDir"
47
- CreateShortcut "$StartMenuDir\regen-mde.lnk" "$INSTDIR\BuildCorpusEditor.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
48
- CreateShortcut "$StartMenuDir\Uninstall regen-mde.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
49
-
50
- WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen-mde"
51
- WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
52
- WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
53
-
54
- WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen-mde"
55
- WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
56
- WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
57
-
58
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayName" "regen-mde"
59
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayVersion" "${VERSION}"
60
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "Publisher" "LIFE AI"
61
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "InstallLocation" "$INSTDIR"
62
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayIcon" "$INSTDIR\BuildCorpusEditor.exe"
63
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "UninstallString" '"$INSTDIR\uninstall.exe"'
64
- SectionEnd
65
-
66
- Section "Uninstall"
67
- SetShellVarContext current
68
- Delete "$SMPROGRAMS\LIFE AI\regen-mde.lnk"
69
- Delete "$SMPROGRAMS\LIFE AI\Uninstall regen-mde.lnk"
70
- RMDir "$SMPROGRAMS\LIFE AI"
71
-
72
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
73
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
74
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
75
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
76
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
77
- DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
78
- DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde"
79
-
80
- RMDir /r "$INSTDIR"
81
- SectionEnd
1
+ !ifndef VERSION
2
+ !define VERSION "0.2.1"
3
+ !endif
4
+ !ifndef APP_SOURCE
5
+ !error "APP_SOURCE must point to the staged app directory"
6
+ !endif
7
+ !ifndef OUT_FILE
8
+ !define OUT_FILE "regen-mde-${VERSION}-win-x64-setup.exe"
9
+ !endif
10
+
11
+ Unicode true
12
+ Name "regen-mde"
13
+ OutFile "${OUT_FILE}"
14
+ InstallDir "$LOCALAPPDATA\Programs\regen-mde"
15
+ RequestExecutionLevel user
16
+ SetCompressor /SOLID lzma
17
+
18
+ !include LogicLib.nsh
19
+
20
+ Var StartMenuDir
21
+
22
+ Function .onInit
23
+ StrCpy $StartMenuDir "$SMPROGRAMS\LIFE AI"
24
+ FunctionEnd
25
+
26
+ Section "Install"
27
+ SetShellVarContext current
28
+
29
+ ; Remove earlier app identities and npm-era shell verbs before installing.
30
+ RMDir /r "$LOCALAPPDATA\Programs\Manuscript Forge"
31
+ RMDir /r "$LOCALAPPDATA\Programs\Regen.MDeditor"
32
+ Delete "$SMPROGRAMS\LIFE AI\Manuscript Forge.lnk"
33
+ Delete "$SMPROGRAMS\LIFE AI\Regen.MDeditor.lnk"
34
+ Delete "$SMPROGRAMS\LIFE AI\Uninstall Regen.MDeditor.lnk"
35
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
36
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
37
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
38
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
39
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
40
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
41
+
42
+ SetOutPath "$INSTDIR"
43
+ File /r "${APP_SOURCE}\*.*"
44
+
45
+ WriteUninstaller "$INSTDIR\uninstall.exe"
46
+ CreateDirectory "$StartMenuDir"
47
+ CreateShortcut "$StartMenuDir\regen-mde.lnk" "$INSTDIR\BuildCorpusEditor.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
48
+ CreateShortcut "$StartMenuDir\Uninstall regen-mde.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\BuildCorpusEditor.exe" 0
49
+
50
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen-mde"
51
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
52
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
53
+
54
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "MUIVerb" "Open in regen-mde"
55
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen" "Icon" "$INSTDIR\BuildCorpusEditor.exe"
56
+ WriteRegStr HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen\command" "" '"$INSTDIR\BuildCorpusEditor.exe" "%1"'
57
+
58
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayName" "regen-mde"
59
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayVersion" "${VERSION}"
60
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "Publisher" "LIFE AI"
61
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "InstallLocation" "$INSTDIR"
62
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "DisplayIcon" "$INSTDIR\BuildCorpusEditor.exe"
63
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde" "UninstallString" '"$INSTDIR\uninstall.exe"'
64
+ SectionEnd
65
+
66
+ Section "Uninstall"
67
+ SetShellVarContext current
68
+ Delete "$SMPROGRAMS\LIFE AI\regen-mde.lnk"
69
+ Delete "$SMPROGRAMS\LIFE AI\Uninstall regen-mde.lnk"
70
+ RMDir "$SMPROGRAMS\LIFE AI"
71
+
72
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\RegenMDEditorOpen"
73
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\RegenMDEditorOpen"
74
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\ManuscriptForgeOpen"
75
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\ManuscriptForgeOpen"
76
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.md\shell\BuildCorpusOpenEditor"
77
+ DeleteRegKey HKCU "Software\Classes\SystemFileAssociations\.docx\shell\BuildCorpusOpenEditor"
78
+ DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\regen-mde"
79
+
80
+ RMDir /r "$INSTDIR"
81
+ SectionEnd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regen.mde",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Convert between DOCX/PPTX and Markdown — Word OMML equations to KaTeX TeX on the way in, LaTeX to native OMML on the way out.",
5
5
  "bin": {
6
6
  "build-corpus": "bin/build-corpus.js",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "build-corpus"
7
- version = "0.8.0"
7
+ version = "0.8.2"
8
8
  description = "Convert between DOCX/PPTX and Markdown — Word OMML equations to KaTeX TeX inbound, LaTeX to native OMML outbound."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"