-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_syllabi.ps1
More file actions
28 lines (23 loc) · 951 Bytes
/
convert_syllabi.ps1
File metadata and controls
28 lines (23 loc) · 951 Bytes
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
Write-Host "Converting syllabi from .docx to .pdf..."
# Locate pandoc bundled with Quarto
$pandocPath = "C:\Users\kibby\AppData\Local\Programs\Quarto\bin\tools\pandoc.exe"
# Fallback to system pandoc if Quarto's not found
if (-Not (Test-Path $pandocPath)) {
$pandocCmd = Get-Command pandoc -ErrorAction SilentlyContinue
if ($pandocCmd) {
$pandocPath = $pandocCmd.Source
} else {
Write-Host "⚠️ Could not find pandoc.exe in Quarto or system PATH."
exit 1
}
}
Write-Host "Using Pandoc at: $pandocPath"
# Convert all .docx syllabi in the syllabi/ folder
$syllabiDir = Join-Path $PSScriptRoot "syllabi"
Get-ChildItem -Path $syllabiDir -Filter "*.docx" | ForEach-Object {
$docx = $_.FullName
$pdf = [System.IO.Path]::ChangeExtension($docx, ".pdf")
Write-Host " - Converting $($_.Name) → $(Split-Path $pdf -Leaf)"
& $pandocPath "$docx" -o "$pdf"
}
Write-Host "✅ Done converting syllabi."