md2gost 1.3.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 +21 -0
- package/README.md +926 -0
- package/assets/run.ps1 +61 -0
- package/assets/styles.xml +1140 -0
- package/assets/template.dotm +0 -0
- package/dist/cli.js +92 -0
- package/dist/cli.js.map +6 -0
- package/dist/index.cjs +2165 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.mjs +2130 -0
- package/dist/index.mjs.map +6 -0
- package/package.json +227 -0
package/assets/run.ps1
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
param (
|
|
2
|
+
[string]$InputDoc,
|
|
3
|
+
[string]$OutputDoc,
|
|
4
|
+
[string]$MacroTemplate,
|
|
5
|
+
[switch]$RenderPDF
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
if (-not $InputDoc) { throw "The input file is not defined" }
|
|
10
|
+
if (-not $OutputDoc) { throw "The output file is not defined" }
|
|
11
|
+
if (-not $MacroTemplate) { throw "The macro template file is not defined" }
|
|
12
|
+
|
|
13
|
+
# --- Проверки --------------------------------------------------
|
|
14
|
+
|
|
15
|
+
if (-not (Test-Path $InputDoc)) {
|
|
16
|
+
throw "The input file was not found: $InputDoc"
|
|
17
|
+
}
|
|
18
|
+
if (-not (Test-Path $MacroTemplate)) {
|
|
19
|
+
throw "The macro file was not found: $MacroTemplate"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$InputDoc = [System.IO.Path]::GetFullPath($InputDoc)
|
|
23
|
+
$OutputDoc = [System.IO.Path]::GetFullPath($OutputDoc)
|
|
24
|
+
$MacroTemplate = [System.IO.Path]::GetFullPath($MacroTemplate)
|
|
25
|
+
|
|
26
|
+
# --- Word ------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
|
|
29
|
+
|
|
30
|
+
$word = New-Object -ComObject Word.Application
|
|
31
|
+
$word.Visible = $false
|
|
32
|
+
$word.DisplayAlerts = 0
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
# Подключаем глобальный шаблон
|
|
36
|
+
$word.AddIns.Add($MacroTemplate, $true)
|
|
37
|
+
|
|
38
|
+
$doc = $word.Documents.Open($InputDoc)
|
|
39
|
+
|
|
40
|
+
# --- Generating -------------------------------------------
|
|
41
|
+
Write-Host "[*1] Generating continued listings..."
|
|
42
|
+
$word.Run("AutoListingContinuation")
|
|
43
|
+
|
|
44
|
+
Write-Host "[*2] Generating continued tables..."
|
|
45
|
+
$word.Run("AutoTableContinuation")
|
|
46
|
+
|
|
47
|
+
# --- Saving -----------------------------------------------
|
|
48
|
+
$doc.SaveAs($OutputDoc, 16)
|
|
49
|
+
|
|
50
|
+
if ($RenderPDF) {
|
|
51
|
+
Write-Host "[*3] Render to PDF..."
|
|
52
|
+
$word.Run("RenderSegmentsToPDF")
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
$doc.Close($false)
|
|
56
|
+
Write-Host "Done: $OutputDoc"
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
$word.Quit()
|
|
60
|
+
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null
|
|
61
|
+
}
|