Skip to content

Commit

Permalink
Docs build.ps1 skips pages tagged with #skipwiki. The tag must be in …
Browse files Browse the repository at this point in the history
…the page title
  • Loading branch information
stevencohn committed Aug 8, 2024
1 parent 3cabf05 commit 5203f85
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions docs/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@ Begin
$sectionID = $sectionName.ToLower() -replace ' |\.|%20', '-'
Write-Host "section '$sectionName' ($sectionID)" -ForegroundColor Blue

$script:skips = @()

$dir = Join-Path $ZipName $sectionName
$toc, $first = MakeSectionTOC $sectionID $sectionName

Get-ChildItem $dir -File *.htm | foreach {
$id = MakePage $sectionID $_.Name $_.FullName $toc
if (-not ($skips -contains $_.FullName))
{
MakePage $sectionID $_.Name $_.FullName $toc
}
}

$indexFile = Join-Path $dir 'index.html'
Expand All @@ -89,12 +94,21 @@ Begin
$file = (Join-Path $ZipName (Join-Path $sectionName $FileOrder)) | Resolve-Path
if (Test-Path $file)
{
$basepath = $file | Split-Path -Parent

# use FileOrder.txt
Get-Content $file -Encoding utf8 | foreach {
$id = $_.ToLower() -replace ' |\.|%20', '-'
$name = "$_`.htm"
$toc += "<li><a id=""$id"" href=""$name"">$($_)</a></li>"
if (!$first) { $first = "/$sectionID/$name" }
if ($name.Contains('#skipwiki'))
{
$script:skips += (Join-Path $basepath $name)
}
else
{
$toc += "<li><a id=""$id"" href=""$name"">$($_)</a></li>"
if (!$first) { $first = "/$sectionID/$name" }
}
}

#Write-Host "deleting $file" -ForegroundColor Yellow
Expand All @@ -107,8 +121,15 @@ Begin
Get-ChildItem (Join-Path $ZipName $sectionName) -File *.htm | foreach {
$id = $_.BaseName.ToLower() -replace ' |\.|%20', '-'
$name = "$($_.BaseName)`.htm"
$toc += "<li><a id=""$id"" href=""$name"">$($_)</a></li>"
if (!$first) { $first = "/$sectionID/$name" }
if ($name.Contains('#skipwiki'))
{
$script:skips += (Join-Path $basepath $name)
}
else
{
$toc += "<li><a id=""$id"" href=""$name"">$($_)</a></li>"
if (!$first) { $first = "/$sectionID/$name" }
}
}
}

Expand Down Expand Up @@ -155,8 +176,6 @@ Begin
$template | Out-File $pageFile -Encoding utf8 -Force -Confirm:$false

AddToSiteMap "$RootUrl/$sectionID/$name`.htm" 0.5

return $pageID
}

function PatchSectionRefs
Expand Down Expand Up @@ -230,13 +249,16 @@ Process
Remove-Item $name -Recurse -Force -Confirm:$false
}

if (Test-Path ./$sectionID)
if ($sectionID -and (Test-Path ./$sectionID))
{
Remove-Item ./$sectionID -Recurse -Force -Confirm:$false
}

# move the new section folder up a level and rename
Move-Item $dir ./$sectionID -Force -Confirm:$false
if ($dir)
{
# move the new section folder up a level and rename
Move-Item $dir ./$sectionID -Force -Confirm:$false
}
}

Write-Host 'saving sitemap.xml'
Expand Down

0 comments on commit 5203f85

Please sign in to comment.