-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
17 lines (16 loc) · 739 Bytes
/
build.ps1
File metadata and controls
17 lines (16 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Fix Example section markup from PlatyPS
$files = dir "$PSSCriptRoot\PSDiff\docs"
$replacements = foreach ($file in $files) {
$exampleText = [RegEx]::Match(($file | Get-Content -Raw), '(?ms)## EXAMPLES(.*)?## PARAMETERS').Groups[1].Value
$examples = ($exampleText -split '###.*EXAMPLE \d\s*[-]*') | select -Skip 1
foreach ($example in $examples) {
[PSCustomObject][ordered]@{
Old = $example
New = "`r`n" + '```' + "`r`n$($example.Replace('```','').Trim())`r`n" + '```' + "`r`n"
Path = $file.FullName
}
}
}
foreach ($replacement in $replacements) {
(Get-Content $replacement.Path -Raw).Replace($replacement.Old, $replacement.New) | Set-Content $replacement.Path
}