$diagramsDir = "diagrams" $outputDir = "slike" # Create output directory if it doesn't exist if (!(Test-Path -Path $outputDir)) { New-Item -ItemType Directory -Path $outputDir | Out-Null } # Get all wrapper .typ files in the diagrams directory (files ending in -img.typ) $files = Get-ChildItem -Path $diagramsDir -Filter "*-img.typ" foreach ($file in $files) { # Remove -img from the output filename to match the desired naming convention $baseName = $file.BaseName -replace "-img$", "" $outputFile = Join-Path -Path $outputDir -ChildPath ($baseName + ".pdf") Write-Host "Compiling $($file.Name) to $outputFile..." # Run typst compile with necessary flags # --root . : Allow access to files in the project root (like definicije.typ) # --ppi 300 : Increase resolution for better quality typst compile --root . --ppi 300 $file.FullName $outputFile if ($LASTEXITCODE -ne 0) { Write-Error "Failed to compile $($file.Name)" } } Write-Host "All diagrams compiled."