Skip to content

Commit b4dfb1a

Browse files
update build script
1 parent b561691 commit b4dfb1a

File tree

4,510 files changed

+6913
-13628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,510 files changed

+6913
-13628
lines changed

build-pdf.ps1

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ if (-not [System.IO.Path]::IsPathRooted($FileListPath)) {
2020

2121
if (-not (Test-Path $FileListPath)) {
2222
Write-Host "ERROR: File list not found: $FileListPath" -ForegroundColor Red
23-
Cleanup; exit 1
23+
Cleanup-Temp
24+
exit 1
2425
}
2526

2627
$files = Get-Content $FileListPath -ErrorAction Stop
@@ -29,7 +30,8 @@ Write-Host "Total files: $($files.Count)"
2930

3031
if ($files.Count -eq 0) {
3132
Write-Host "ERROR: File list is empty: $FileListPath" -ForegroundColor Red
32-
Cleanup; exit 1
33+
Cleanup-Temp
34+
exit 1
3335
} else {
3436
Write-Host "Sample file list entries (first 10):"
3537
$files | Select-Object -First 10 | ForEach-Object { Write-Host " $_" }
@@ -230,7 +232,8 @@ if ($wkhtmlPath) {
230232
Write-Host " - wkhtmltopdf (Windows): https://wkhtmltopdf.org/downloads.html" -ForegroundColor Yellow
231233
Write-Host " - or install via Chocolatey: choco install wkhtmltopdf -y (requires Chocolatey)" -ForegroundColor Yellow
232234
Write-Host " - weasyprint (requires Python + cairo/pango): pip install weasyprint (see https://weasyprint.org/docs/install/)" -ForegroundColor Yellow
233-
Cleanup; exit 1
235+
Cleanup-Temp
236+
exit 1
234237
}
235238

236239
# ---------------------------
@@ -357,32 +360,25 @@ foreach ($file in $sortedFiles) {
357360
'2705' = @{ char = [System.Text.Encoding]::UTF32.GetString([System.BitConverter]::GetBytes(0x2705)); desc = 'check' }
358361
'274c' = @{ char = [System.Text.Encoding]::UTF32.GetString([System.BitConverter]::GetBytes(0x274C)); desc = 'cross' }
359362
}
360-
361363
# Replace each emoji with an inline image using Twemoji CDN
362364
# The images are sized to match text (0.9em) and aligned with baseline for proper inline display
363365
# We add a data-emoji attribute to identify these as inline emojis (not content images)
364366
foreach ($codepoint in $emojiMap.Keys) {
365367
$emojiChar = $emojiMap[$codepoint].char
366368
$emojiDesc = $emojiMap[$codepoint].desc
367369
$imgTag = "<img data-emoji='true' src='https://cdn.jsdelivr.net/gh/twitter/twemoji@latest/assets/72x72/$codepoint.png' alt='$emojiDesc' style='display: inline-block; width: 0.9em; height: 0.9em; vertical-align: -0.1em; margin: 0 0.05em;'>"
368-
$content = $content.Replace($emojiChar, $imgTag)
370+
# Replace any occurrence of the emoji character with the Twemoji <img> tag.
371+
# Use regex escape to avoid treating the character as a special regex token.
372+
try {
373+
$pattern = [regex]::Escape($emojiChar)
374+
$content = [regex]::Replace($content, $pattern, { param($m) $imgTag })
375+
} catch {
376+
# If replacement fails for any reason, continue without stopping the whole process.
377+
# Use a formatted string to avoid ambiguous variable parsing (e.g. "$codepoint: $_" can be mis-parsed).
378+
Write-Host ("Warning: failed to replace emoji {0}: {1}" -f $codepoint, $_) -ForegroundColor Yellow
379+
}
369380
}
370381

371-
# Remove ## Author and ## Auteur sections (heading and content until next heading or end)
372-
# Handle variations: different heading levels (#, ##, ###, ####), case variations, emoji (👤 or text), and potential extra spaces
373-
# This regex matches any heading (1-4 levels) with Author/Auteur (with or without emoji) and removes everything until the next heading or end of file
374-
# Enhanced to handle: trailing colons, various whitespace, and any Unicode emoji
375-
$content = $content -replace '(?mis)^\s{0,3}#{1,6}\s*(?:[\p{So}\p{Sk}\p{P}\p{S}\s]*)*(?:author|auteur)s?\s*:?\s*$.*?(?=^\s{0,3}#{1,6}\s|\z)', ''
376-
377-
# Remove single-line patterns such as "Author: Name" or "Auteur: Name"
378-
$content = $content -replace '(?mi)^\s*(?:author|auteur)s?\s*:\s*.+$', ''
379-
380-
# Remove two-line patterns where a bare "Author" / "Auteur" line is followed by a short non-heading line (the author name).
381-
# Use a safer pattern that doesn't embed single-quote/backtick characters inside the literal.
382-
$content = $content -replace '(?mis)^\s*(?:author|auteur)s?\s*\r?\n\s*(?!#{1,6})(.{1,120})\s*(?=\r?\n|\z)', ''
383-
384-
# Also clean up any potential multiple blank lines left behind by the removal
385-
$content = $content -replace '(?m)^\s*$\n(?:\s*$\n)+', "`n`n"
386382

387383
# Remove inline width/height attributes from img tags to let CSS control sizing
388384
$content = [regex]::Replace($content, '<img([^>]*)\s+width="[^"]*"', '<img$1')
@@ -655,47 +651,58 @@ try {
655651
# Enable emoji support so markdown emojis render correctly instead of as square characters
656652
$pandocArgs += "--from=markdown+emoji"
657653
$pandocArgs += "--css=pdf-style-v2.css"
658-
# Use --mathml instead of --webtex to avoid SSL/network issues with external LaTeX rendering services
659-
# MathML is supported by modern browsers and wkhtmltopdf's rendering engine
660-
$pandocArgs += "--mathml"
654+
$pandocArgs += "--webtex"
661655
$pandocArgs += "--syntax-highlighting=pygments"
662656
$pandocArgs += $tempMarkdown
663657
$pandocArgs += "-o"
664658
$pandocArgs += $OutputFile
665659

666660
if (-not (Test-Path $tempMarkdown)) {
667661
Write-Host "ERROR: Combined markdown file not found: $tempMarkdown" -ForegroundColor Red
668-
Cleanup; exit 1
662+
Cleanup-Temp
663+
exit 1
669664
}
670665

671666
& pandoc @pandocArgs
672667

673668
# Clean up temporary file
674-
Cleanup
669+
Remove-Item $tempMarkdown -ErrorAction SilentlyContinue
675670

671+
# Clean up converted images dir
672+
if (Test-Path $convertedDir) {
673+
Remove-Item $convertedDir -Recurse -Force -ErrorAction SilentlyContinue
674+
}
675+
676676
if (Test-Path $OutputFile) {
677677
Write-Host "SUCCESS: PDF generated: $OutputFile" -ForegroundColor Green
678-
Cleanup; exit 0
678+
exit 0
679679
} else {
680680
Write-Host "ERROR: PDF file was not created" -ForegroundColor Red
681-
Cleanup; exit 1
681+
exit 1
682682
}
683683
} catch {
684684
Write-Host "ERROR: Pandoc execution failed: $_" -ForegroundColor Red
685-
Cleanup; exit 1
685+
if (Test-Path $tempMarkdown) {
686+
Remove-Item $tempMarkdown
687+
}
688+
# Clean up converted images dir on error too
689+
if (Test-Path $convertedDir) {
690+
Remove-Item $convertedDir -Recurse -Force
691+
}
692+
exit 1
686693
}
687694

688695
# ---------------------------
689-
# Cleanup helper: remove temp files/dirs if they exist
690-
function Cleanup {
696+
# centralized cleanup for temporary artifacts
697+
function Cleanup-Temp {
691698
try {
692699
if ($tempMarkdown -and (Test-Path $tempMarkdown)) {
693700
Remove-Item $tempMarkdown -Force -ErrorAction SilentlyContinue
694701
}
695-
} catch { }
702+
} catch {}
696703
try {
697704
if ($convertedDir -and (Test-Path $convertedDir)) {
698705
Remove-Item $convertedDir -Recurse -Force -ErrorAction SilentlyContinue
699706
}
700-
} catch { }
707+
} catch {}
701708
}

docs/releases/en_US/v1.15.0/assert_functions/assert.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,7 @@
140140
</tr>
141141
</table>
142142
</div>
143-
<div class="section" style="margin-top:30px;">
144-
<div class="section-title">
145-
<span class="syntax-icon">👤</span>Author</div>
146-
<div>Allan CORNET</div>
147-
</div>
148-
<div class="section" style="margin-top:40px; text-align:center;">
143+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
149144
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
150145
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
151146
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/assert_functions/assert_checkerror.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,7 @@
143143
</tr>
144144
</table>
145145
</div>
146-
<div class="section" style="margin-top:30px;">
147-
<div class="section-title">
148-
<span class="syntax-icon">👤</span>Author</div>
149-
<div>Allan CORNET</div>
150-
</div>
151-
<div class="section" style="margin-top:40px; text-align:center;">
146+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
152147
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
153148
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
154149
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/assert_functions/assert_isapprox.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,7 @@
146146
</tr>
147147
</table>
148148
</div>
149-
<div class="section" style="margin-top:30px;">
150-
<div class="section-title">
151-
<span class="syntax-icon">👤</span>Author</div>
152-
<div>Allan CORNET</div>
153-
</div>
154-
<div class="section" style="margin-top:40px; text-align:center;">
149+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
155150
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
156151
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
157152
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/assert_functions/assert_isequal.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,7 @@
150150
</tr>
151151
</table>
152152
</div>
153-
<div class="section" style="margin-top:30px;">
154-
<div class="section-title">
155-
<span class="syntax-icon">👤</span>Author</div>
156-
<div>Allan CORNET</div>
157-
</div>
158-
<div class="section" style="margin-top:40px; text-align:center;">
153+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
159154
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
160155
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
161156
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/assert_functions/assert_isfalse.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,7 @@
151151
</tr>
152152
</table>
153153
</div>
154-
<div class="section" style="margin-top:30px;">
155-
<div class="section-title">
156-
<span class="syntax-icon">👤</span>Author</div>
157-
<div>Allan CORNET</div>
158-
</div>
159-
<div class="section" style="margin-top:40px; text-align:center;">
154+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
160155
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
161156
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
162157
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/assert_functions/assert_istrue.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,7 @@
152152
</tr>
153153
</table>
154154
</div>
155-
<div class="section" style="margin-top:30px;">
156-
<div class="section-title">
157-
<span class="syntax-icon">👤</span>Author</div>
158-
<div>Allan CORNET</div>
159-
</div>
160-
<div class="section" style="margin-top:40px; text-align:center;">
155+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
161156
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
162157
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
163158
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/audio/audiodevinfo.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,7 @@
132132
</tr>
133133
</table>
134134
</div>
135-
<div class="section" style="margin-top:30px;">
136-
<div class="section-title">
137-
<span class="syntax-icon">👤</span>Author</div>
138-
<div>Allan CORNET</div>
139-
</div>
140-
<div class="section" style="margin-top:40px; text-align:center;">
135+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
141136
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
142137
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
143138
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/audio/audioinfo.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,7 @@
8686
</tr>
8787
</table>
8888
</div>
89-
<div class="section" style="margin-top:30px;">
90-
<div class="section-title">
91-
<span class="syntax-icon">👤</span>Author</div>
92-
<div>Allan CORNET</div>
93-
</div>
94-
<div class="section" style="margin-top:40px; text-align:center;">
89+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
9590
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
9691
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
9792
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

docs/releases/en_US/v1.15.0/audio/audiometadata.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,7 @@
113113
</tr>
114114
</table>
115115
</div>
116-
<div class="section" style="margin-top:30px;">
117-
<div class="section-title">
118-
<span class="syntax-icon">👤</span>Author</div>
119-
<div>Allan CORNET</div>
120-
</div>
121-
<div class="section" style="margin-top:40px; text-align:center;">
116+
<!--Author: Allan CORNET--><div class="section" style="margin-top:40px; text-align:center;">
122117
<a id="github-edit-link" class="github-edit-btn" target="_blank" rel="noopener noreferrer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg><span id="github-edit-text">Edit this page on GitHub</span></a><style>
123118
.github-edit-btn { display:inline-flex; align-items:center; gap:6px; font-size:14px; padding:6px 12px; border:1px solid #ddd; border-radius:4px; background:#f5f5f5; color:#333; text-decoration:none; transition:all 0.2s ease; }
124119
.github-edit-btn:hover { background:#e9e9e9; border-color:#ccc; color:#000; }

0 commit comments

Comments
 (0)