refactor: merge protocol cores as SETProtocol
This commit is contained in:
32
doc/build-setprotocol-html.ps1
Normal file
32
doc/build-setprotocol-html.ps1
Normal file
@@ -0,0 +1,32 @@
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$outputPath = Join-Path $PSScriptRoot 'setprotocol.html'
|
||||
$sourcePath = Join-Path $PSScriptRoot '..\c\set-protocol\docs\SETPROTOCOL.md'
|
||||
|
||||
$markdown = Get-Content -Raw -LiteralPath $sourcePath -Encoding UTF8
|
||||
$html = (ConvertFrom-Markdown -InputObject $markdown).Html
|
||||
$generatedBlock = @"
|
||||
<!-- SETPROTOCOL:START -->
|
||||
<article class="card full-doc" data-source="c/set-protocol/docs/SETPROTOCOL.md">
|
||||
$html
|
||||
</article>
|
||||
<!-- SETPROTOCOL:END -->
|
||||
"@
|
||||
|
||||
$page = Get-Content -Raw -LiteralPath $outputPath -Encoding UTF8
|
||||
$pattern = '(?s)<!-- SETPROTOCOL:START -->.*?<!-- SETPROTOCOL:END -->'
|
||||
if ($page -notmatch $pattern) {
|
||||
throw 'Не найдены маркеры SETPROTOCOL:START/END в doc/setprotocol.html.'
|
||||
}
|
||||
|
||||
$page = [regex]::Replace($page, $pattern, [System.Text.RegularExpressions.MatchEvaluator]{
|
||||
param($match)
|
||||
$generatedBlock
|
||||
}, 1)
|
||||
|
||||
$page = $page.TrimEnd("`r", "`n") + [Environment]::NewLine
|
||||
$utf8WithoutBom = [System.Text.UTF8Encoding]::new($false)
|
||||
[System.IO.File]::WriteAllText($outputPath, $page, $utf8WithoutBom)
|
||||
Write-Host "[DONE] SETProtocol HTML: $outputPath"
|
||||
File diff suppressed because one or more lines are too long
608
doc/setprotocol.html
Normal file
608
doc/setprotocol.html
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user