sim-manajement-book/scripts/build-worksheets.ps1
hb_alim 9652061f1c feat: complete manuscript — 18 chapters, 18 worksheets, back matter, audit, and PDF build scripts
- foundation/: MASTER-ANCHOR, BOOK-SPEC, BLUEPRINT, WRITING-TEMPLATE, REFERENCE-BANK
- chapters/: 18 bab (bab-01 s.d. bab-18) + 18 outlines
- worksheets/: 18 worksheet pendamping (A01-A18)
- backmatter/: references, glosarium, indeks, kata-pengantar, tentang-penulis
- scripts/: build-book.ps1, build-worksheets.ps1 (Pandoc + XeLaTeX)
- templates/: book-template.tex (B5, Times New Roman, margin sesuai BOOK-SPEC)
- AUDIT-REPORT.md: Phase 6 consistency audit — all gates passed
- PRINT-GUIDE.md: instruksi lengkap cetak PDF

RTI-20252 methodology Phase 1-6 complete. Publication-ready.
2026-04-06 05:05:17 +07:00

81 lines
2.5 KiB
PowerShell

# ============================================================
# build-worksheets.ps1 — Gabung 18 worksheet → 1 PDF
# ============================================================
$ErrorActionPreference = "Stop"
$ProjectRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
$BuildDir = Join-Path $ProjectRoot "build"
$TemplateDir = Join-Path $ProjectRoot "templates"
$WorksheetDir = Join-Path $ProjectRoot "worksheets"
$OutputFile = Join-Path $BuildDir "SIM-Era-AI-Worksheets.pdf"
$Template = Join-Path $TemplateDir "book-template.tex"
# ── Buat folder build ──
if (-not (Test-Path $BuildDir)) {
New-Item -ItemType Directory -Path $BuildDir -Force | Out-Null
}
# ── Susun urutan file ──
$InputFiles = @()
for ($i = 1; $i -le 18; $i++) {
$wsFile = Join-Path $WorksheetDir ("worksheet-A{0:D2}.md" -f $i)
if (Test-Path $wsFile) {
$InputFiles += $wsFile
} else {
Write-Warning "File tidak ditemukan: $wsFile"
}
}
# ── Validasi ──
$missing = $InputFiles | Where-Object { -not (Test-Path $_) }
if ($missing) {
Write-Error "File berikut tidak ditemukan:`n$($missing -join "`n")"
exit 1
}
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " BUILD WORKSHEET: SIM di Era AI" -ForegroundColor Cyan
Write-Host " Output : $OutputFile" -ForegroundColor Cyan
Write-Host " Files : $($InputFiles.Count) file" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
# ── Pandoc command ──
$pandocArgs = @(
$InputFiles
"-o", $OutputFile
"--pdf-engine=xelatex"
"--template=$Template"
"--metadata", "title=Lembar Kerja Mahasiswa (Worksheet)"
"--metadata", "subtitle=Pendamping Buku SIM di Era AI"
"--metadata", "author=Helmi Bahar Alim, S.Kom., M.Kom."
"--metadata", "date=2025"
"--metadata", "lang=id"
"--toc"
"--toc-depth=2"
"--number-sections"
"--top-level-division=chapter"
"--shift-heading-level-by=-1"
"--columns=72"
"--resource-path=$ProjectRoot"
)
Write-Host "`nMenjalankan Pandoc..." -ForegroundColor Yellow
& pandoc @pandocArgs
if ($LASTEXITCODE -eq 0) {
$fileSize = [math]::Round((Get-Item $OutputFile).Length / 1MB, 2)
Write-Host "`n✅ Build berhasil!" -ForegroundColor Green
Write-Host " File : $OutputFile" -ForegroundColor Green
Write-Host " Ukuran: $fileSize MB" -ForegroundColor Green
} else {
Write-Error "❌ Pandoc gagal dengan exit code $LASTEXITCODE"
exit 1
}