-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIndex.PSSVG.ps1
More file actions
35 lines (28 loc) · 1.01 KB
/
Index.PSSVG.ps1
File metadata and controls
35 lines (28 loc) · 1.01 KB
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
29
30
31
32
33
#requires -Module PSSVG
$fileList = @(Get-ChildItem -Path $PSScriptRoot)
$fileListText = $fileList | Select-Object Name | Out-String -Width 1kb
$fileListLines = @($fileListText -split '(?>\r\n|\n)')
$fontSize = 14
$ln = 0
$maxLineLength =0
$goldenRatio = (1 + [Math]::Sqrt(5)) / 2
svg (
svg.text -Fontsize $fontSize -FontFamily monospace -Fill '#4488ff' @(
foreach ($line in $fileListLines) {
$ln++
$href =
if ($ln -le 2) {
"."
} else {
$file = $fileList[$ln - 3]
$file.Name
}
if ($line.Length -gt $maxLineLength) {
$maxLineLength = $line.Length
}
svg.a -href $href (
svg.tspan -X 0 -DY 1.2em -Fontsize $fontSize $fileListLines[$ln] -Xmlspace preserve -Fontfamily monospace -Fill '#4488ff'
)
}
)
) -OutputPath (Join-Path $PSScriptRoot Index.svg) -ViewBox "0 0 $(($maxLineLength * $fontSize)/$goldenRatio) $($ln * $fontSize * 1.2)"