Files
typogenie/fix-academic-templates.ps1
TypoGenie a6f664088c feat: port all template categories to JSON format
- Ported Minimalist templates to JSON (Swiss Grid, Brutalist, etc.)
- Ported Tech templates to JSON (SaaS, Terminal, Cyberpunk, etc.)
- Ported Creative templates to JSON (Art Gallery, Zine, Pop Art, etc.)
- Ported Industrial templates to JSON (Blueprint, Factory, Schematic, etc.)
- Ported Nature templates to JSON (Botanical, Ocean, Mountain, etc.)
- Ported Lifestyle templates to JSON (Cookbook, Travel, Coffee House, etc.)
- Ported Vintage templates to JSON (Art Deco, Medieval, Retro 80s, etc.)
- Updated README.md to reflect the new JSON-based style system (example configuration and contribution workflow)
- Completed migration of over 150 styles to the new architecture
2026-02-01 18:51:43 +02:00

112 lines
3.4 KiB
PowerShell

# Script to add missing advanced elements to all Academic templates
# Adds: del, sup, sub, mark, footnote, footnoteRef
$academicTemplates = @(
"academic\academic-journal.json",
"academic\arctic-base.json",
"academic\botanical-textbook.json",
"academic\chemistry-lab.json",
"academic\dark-academia.json",
"academic\education-friendly.json",
"academic\emergency-room.json",
"academic\furniture-manual.json",
"academic\history-textbook.json",
"academic\kids-education.json",
"academic\mathematics-paper.json",
"academic\medical-professional.json",
"academic\phd-thesis.json",
"academic\scantron-test.json",
"academic\scientific-journal.json",
"academic\weather-radar.json"
)
$advancedElements = @{
"del" = @{
"_comment_del" = "~~strikethrough~~ - deleted text"
"del" = @{
"font" = "body"
"strikethrough" = $true
}
}
"sup" = @{
"_comment_sup" = "^superscript^ - superscript text"
"sup" = @{
"font" = "body"
"size" = 8
"superScript" = $true
}
}
"sub" = @{
"_comment_sub" = "~subscript~ - subscript text"
"sub" = @{
"font" = "body"
"size" = 8
"subScript" = $true
}
}
"mark" = @{
"_comment_mark" = "==highlighted text== - marked/highlighted text"
"mark" = @{
"font" = "body"
"background" = "accent"
"color" = "FFFFFF"
}
}
"footnote" = @{
"_comment_footnote" = "[^1] - footnote references"
"footnote" = @{
"font" = "body"
"size" = 9
"color" = "textSecondary"
"superScript" = $true
}
}
"footnoteRef" = @{
"_comment_footnote_ref" = "Footnote content at bottom of page"
"footnoteRef" = @{
"font" = "body"
"size" = 9
"color" = "textSecondary"
"spacing" = @{
"before" = 6
"after" = 6
"line" = 1.2
}
}
}
}
foreach ($templatePath in $academicTemplates) {
$fullPath = "src-tauri\templates\$templatePath"
try {
$content = Get-Content $fullPath -Raw | ConvertFrom-Json
# Add missing elements
$modified = $false
foreach ($elementName in @('del', 'sup', 'sub', 'mark', 'footnote', 'footnoteRef')) {
if (-not $content.elements.PSObject.Properties.Name.Contains($elementName)) {
$elementData = $advancedElements[$elementName]
foreach ($prop in $elementData.Keys) {
$content.elements | Add-Member -MemberType NoteProperty -Name $prop -Value $elementData[$prop] -Force
}
$modified = $true
}
}
if ($modified) {
# Write back with proper formatting
$json = $content | ConvertTo-Json -Depth 10
[System.IO.File]::WriteAllLines($fullPath, $json)
Write-Host "✅ Updated: $templatePath" -ForegroundColor Green
} else {
Write-Host "⏭️ Skipped: $templatePath (already complete)" -ForegroundColor Yellow
}
} catch {
Write-Host "❌ Error updating $templatePath`: $_" -ForegroundColor Red
}
}
Write-Host "`n✅ Academic templates update complete!" -ForegroundColor Green