@@ -10,8 +10,8 @@ param (
1010)
1111
1212Function Write-Description {
13- # Basic indented descriptive build output.
14- param (
13+ # Basic indented descriptive build output. $Description can contain Newlines.
14+ Param (
1515 [string ]$color = ' White' ,
1616 [string ]$Description = ' ' ,
1717 [int ]$Level = 0 ,
@@ -22,11 +22,12 @@ Function Write-Description {
2222 )
2323
2424 $thisindent = (' ' * $indent ) * $level
25- if ($accent ) {
25+ If ($accent ) {
2626 $accentleft = $AccentL
2727 $accentright = $AccentR
2828 }
29- Write-Build $color " $accentleft$thisindent$Description$accentright "
29+
30+ $Description -split ' \r\n|\n' | ForEach-Object { Write-Build $color " $accentleft$thisindent $ ( $_ ) $accentright " }
3031}
3132
3233if (Test-Path $BuildFile ) {
@@ -445,14 +446,14 @@ task UpdateCBH {
445446"@
446447
447448 $ScratchPath = Join-Path $BuildRoot $Script :BuildEnv.ScratchFolder
448- $CBHPattern = " (?ms)(\<#.*\.SYNOPSIS.*?#>) "
449+ [ Regex ] $CBHPattern = ' (?ms)\<\#(\#(?!\>)|[^#])*\#\> '
449450 Get-ChildItem - Path " $ ( $ScratchPath ) \$ ( $Script :BuildEnv.PublicFunctionSource ) \*.ps1" - File | ForEach-Object {
450451 $FormattedOutFile = $_.FullName
451452 $FileName = $_.Name
452453 Write-Description White " Replacing CBH in file: $ ( $FileName ) " - level 2
453454 $FunctionName = $FileName -replace ' .ps1' , ' '
454455 $NewExternalHelp = $ExternalHelp -replace ' {{LINK}}' , ($Script :BuildEnv.ModuleWebsite + " /tree/master/$ ( $Script :BuildEnv.BaseReleaseFolder ) /$ ( $Script :BuildEnv.ModuleVersion ) /docs/Functions/$ ( $FunctionName ) .md" )
455- $UpdatedFile = ( get-content $FormattedOutFile - raw) -replace $CBHPattern , $NewExternalHelp
456+ $UpdatedFile = $CBHPattern .Replace ( ( Get-Content $FormattedOutFile - raw), $NewExternalHelp , 1 )
456457 $UpdatedFile | Out-File - FilePath $FormattedOutFile - force - Encoding $Script :BuildEnv.Encoding
457458 }
458459}
0 commit comments