-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_html.ps1
75 lines (63 loc) · 2.2 KB
/
build_html.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$env:PUPPETEER_TIMEOUT = 3600
$baseUrl = "https://github.com/CUG-hydro/class2023_CUG_HydroMet/blob/master/images/"
$baseUrl = "https://raw.githubusercontent.com/CUG-hydro/class2023_CUG_HydroMet/master/images/"
function ReplaceStringInFile {
param (
[string]$fin,
[string]$searchString,
[string]$replacementString
)
$fileContent = Get-Content -Path $fin -Raw
$newContent = $fileContent -replace $searchString, $replacementString
# $tempFin = [System.IO.Path]::GetTempFileName()
$tempFin="__temp__.md"
Set-Content -Path $tempFin -Value $newContent
$tempFin
}
function build_marp{
param (
$fin,
$verbose = 1,
$time = 0
)
$theme = "./themes/beamer.css"
$fout = ($fin).Replace(".md", ".html")
$fin = ReplaceStringInFile $fin "images/" $baseUrl
# -c .marprc.yml # lead to theme failed
$cmd = "marp $fin -o docs/$fout --html --allow-local-files --theme $theme $options"
if ($verbose) {
Write-Output $cmd
}
if ($time) {
Measure-Command { Invoke-Expression $cmd }
} else {
Invoke-Expression $cmd
}
}
$options = ""
# build_marp "README.md"
# build_marp "2023期满考核.md"
# build_marp "ch03_位势高度与气压场.md"
# build_marp "ch02_大气的基本特征.md"
# build_marp "ch01_补充_天气学网站.md"
# build_marp "ch01_补充_全球气候变化.md"
# build_marp "ch01_绪论.md"
# build_marp "ch00_课程介绍.md"
build_marp "index.md"
# pandoc README.md -o docs/README.html
# build_marp "./examples/high_level.md" "beamer_high"
# build_marp "./examples/low_level.md" "beamer_low"
# build_marp "./ch02_大气的基本特征.md"
# build_marp "./ch03_位势高度与气压场.md"
build_marp "./ch04_第1讲-水汽通量与暴雨分析.md"
build_marp "./ch04_第2讲-辐散与垂直运动.md"
# build_marp "./ch05_第1讲-辐射与能量平衡.md"
# build_marp "./ch05_第2讲-热浪研究方法.md"
# build_marp "./ch06_大气环流.md"
# build_marp "./ch07_天气系统.md"
# build_marp "./地信研究生_现代气候学_part1.md"
# build_marp "./地信研究生_现代气候学_part2.1.md"
# build_marp "./地信研究生_现代气候学_part2.2.md"
# build_marp "index.md"
# build_marp "./examples/low_level.md" "pages/beamer_low.$ext"
# mv *.pdf 课件