Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Docs/mirror-local-docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ $DocsRoot = Join-Path $RepoRoot "Docs/pages/docs"

# Mirrors AggregatedSources in Pipeline/Build.Pages.cs.
$Sources = @(
[pscustomobject]@{ Repo="Testably.Abstractions"; SourcePath="Docs/pages/docs"; Target="Abstractions"; InlineReadme=$false; ExtraReadmes=@() }
[pscustomobject]@{ Repo="aweXpect"; SourcePath="Docs/pages"; Target="aweXpect"; InlineReadme=$false; ExtraReadmes=@(
[pscustomobject]@{ Repo="Testably.Abstractions"; SourcePath="Docs/pages/docs"; Target="Abstractions"; InlineReadme=$false; ExtraReadmes=@() }
[pscustomobject]@{ Repo="Testably.Abstractions.Migration"; SourcePath="Docs/pages"; Target="Abstractions/migration-from-testableio/Migration"; InlineReadme=$true; ExtraReadmes=@() }
[pscustomobject]@{ Repo="aweXpect"; SourcePath="Docs/pages"; Target="aweXpect"; InlineReadme=$false; ExtraReadmes=@(
[pscustomobject]@{ Repo="aweXpect.Migration"; TargetFile="10-migration.md" }
) }
[pscustomobject]@{ Repo="aweXpect.Json"; SourcePath="Docs/pages"; Target="Extensions/aweXpect.Json"; InlineReadme=$true; ExtraReadmes=@() }
Expand Down Expand Up @@ -72,15 +73,15 @@ function Strip-ReadmeFront([string]$readme) {

function Get-ReadmeIntro([string]$readmePath) {
if (-not (Test-Path -LiteralPath $readmePath)) { return "" }
$content = Get-Content -Raw -LiteralPath $readmePath
$content = Get-Content -Raw -LiteralPath $readmePath -Encoding UTF8
$idx = $content.IndexOf("`n##")
if ($idx -gt 0) { return $content.Substring($idx) }
return ""
}

function Get-ReadmeBody([string]$readmePath) {
if (-not (Test-Path -LiteralPath $readmePath)) { return "" }
$content = Get-Content -Raw -LiteralPath $readmePath
$content = Get-Content -Raw -LiteralPath $readmePath -Encoding UTF8
return Strip-ReadmeFront $content
}

Expand Down Expand Up @@ -178,7 +179,7 @@ foreach ($source in $Sources) {
$isText = $TextExt -contains $ext

if ($isText) {
$content = Get-Content -Raw -LiteralPath $file.FullName
$content = Get-Content -Raw -LiteralPath $file.FullName -Encoding UTF8
if ($null -eq $content) { $content = "" }

if ($source.InlineReadme -and -not $readmeIntroDone -and $name.StartsWith("00-") -and $content.Contains("{README}")) {
Expand Down
6 changes: 4 additions & 2 deletions Pipeline/Build.Pages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ record ReadmeSubstitution(
/// </summary>
static readonly DocsSource[] AggregatedSources =
[
new("Testably", "Testably.Abstractions", "Docs/pages/docs", "Abstractions"),
new("Testably", "aweXpect", "Docs/pages", "aweXpect",
new("Testably", "Testably.Abstractions", "Docs/pages/docs", "Abstractions"),
new("Testably", "Testably.Abstractions.Migration", "Docs/pages", "Abstractions/migration-from-testableio/Migration",
InlineReadme: true),
new("Testably", "aweXpect", "Docs/pages", "aweXpect",
ExtraReadmes:
[
new("Testably", "aweXpect.Migration", "10-migration.md"),
Expand Down
Loading