vault backup: 2025-11-10 16:55:49
This commit is contained in:
@@ -24,17 +24,37 @@ Set-Content -Path $Path -Value $newContent
|
||||
## Converting NFPA Code
|
||||
|
||||
```powershell
|
||||
param(
|
||||
[string]$Path,
|
||||
[string]$DestinationPath
|
||||
)
|
||||
|
||||
$content = Get-Content -Path $Path
|
||||
$newContent = $content
|
||||
|
||||
# "210.17(B)(3)" -> h5
|
||||
$newContent -replace '^(\d{3}\.\d+\([A-Z]\)\(\d\) .+)$', '\n##### $1\n'
|
||||
$newContent = $newContent -replace '^(\d{3}\.\d+\([A-Z]\)\(\d\) .+)$', "`n##### `$1`n"
|
||||
|
||||
# "210.17(B)" -> h4
|
||||
$newContent -replace '^(\d{3}\.\d+\([A-Z]\) .+)$', '\n#### $1\n'
|
||||
$newContent = $newContent -replace '^(\d{3}\.\d+\([A-Z]\) .+)$', "`n#### `$1`n"
|
||||
|
||||
# "210.17" -> h3
|
||||
$newContent -replace '^(\d{3}\.\d+ .+)$', '\n### $1\n'
|
||||
$newContent = $newContent -replace '^(\d{3}\.\d+ .+)$', "`n### `$1`n"
|
||||
|
||||
# "Part I. General" -> h2
|
||||
$newContent = $newContent -replace '^(Part [IVX]+\. .+)$', "`n## `$1`n"
|
||||
|
||||
# "(1)" -> "1."
|
||||
$newContent -replace '^\((\d)\)', '$1\.'
|
||||
$newContent = $newContent -replace '^\((\d\d?)\)', "`$1."
|
||||
|
||||
# "(41⁄ 2 ft)" -> "(4 1/2 ft)"
|
||||
# TODO: \u2044
|
||||
|
||||
# "Informational Note: Types NM, NMC..."
|
||||
# "Informational Note No. 1:"
|
||||
|
||||
New-Item -Type File -Path $DestinationPath -ErrorAction SilentlyContinue | Out-Null
|
||||
Set-Content -Path $DestinationPath -Value $newContent
|
||||
```
|
||||
|
||||
## Semantic Line Breaks
|
||||
|
||||
Reference in New Issue
Block a user