File tree 3 files changed +21
-7
lines changed
3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22
22
defaults to ` $true ` .
23
23
- ` Clean_WikiContent_For_GitHub_Publish ` - This task will remove the top
24
24
level header from any markdown file where the top level header equals the
25
- filename (converting Unicode hyphen to ASCII hyphen before comparison).
26
- It can be controlled by parameter ` RemoveTopLevelHeader ` in the task, which
27
- defaults to ` $true ` .
25
+ filename. The task will convert standard hyphens to spaces and Unicode
26
+ hyphens to standard hyphens before comparison. The task can be controlled
27
+ by parameter ` RemoveTopLevelHeader ` in the task, which defaults to ` $true ` .
28
28
29
29
### Changed
30
30
Original file line number Diff line number Diff line change @@ -113,9 +113,10 @@ Task Clean_WikiContent_For_GitHub_Publish {
113
113
114
114
$hasTopHeader = $content -match ' (?m)^#\s+([^\r\n]+)'
115
115
116
- $baseNameWithoutNonBreakingHyphen = $_.BaseName -replace [System.Char ]::ConvertFromUtf32(0x2011 ), ' -'
116
+ $convertedBaseName = $_.BaseName -replace ' -' , ' '
117
+ $convertedBaseName = $convertedBaseName -replace [System.Char ]::ConvertFromUtf32(0x2011 ), ' -'
117
118
118
- if ($hasTopHeader -and $Matches [1 ] -eq $baseNameWithoutNonBreakingHyphen )
119
+ if ($hasTopHeader -and $Matches [1 ] -eq $convertedBaseName )
119
120
{
120
121
Write-Build - Color DarkGray - Text (' Top level header is the same as the filename. Removing top level header from: {0}' -f $_.Name )
121
122
Original file line number Diff line number Diff line change @@ -35,9 +35,18 @@ Describe 'Clean_WikiContent_For_GitHub_Publish' {
35
35
36
36
New-Item - Path " $ ( $TestDrive.FullName ) /WikiContent" - ItemType ' Directory' - Force | Out-Null
37
37
38
- Set-Content - Path " $ ( $TestDrive.FullName ) /WikiContent/Get-Something.md" - Value ' Mock markdown file 1'
38
+ # Will not be modified
39
+ Set-Content - Path " $ ( $TestDrive.FullName ) /WikiContent/Get-Something.md" - Value ' # Get-Something`nMock markdown file 1'
39
40
40
- Set-Content - Path " $ ( $TestDrive.FullName ) /WikiContent/home.md" - Value ' Mock markdown file 1'
41
+ # Will be modified
42
+ Set-Content - Path " $ ( $TestDrive.FullName ) /WikiContent/Credential-overview.md" - Value " # Credential overview`n Mock markdown file 3"
43
+
44
+ # Will not be modified
45
+ Set-Content - Path " $ ( $TestDrive.FullName ) /WikiContent/Home.md" - Value " # My Module Name`n Mock markdown file 4"
46
+
47
+ Mock - CommandName Set-Content - MockWith {
48
+ Write-Verbose - Message (' Setting content of: {0}' -f $Path ) - Verbose
49
+ }
41
50
}
42
51
43
52
It ' Should export the build script alias' {
@@ -67,5 +76,9 @@ Describe 'Clean_WikiContent_For_GitHub_Publish' {
67
76
68
77
Invoke-Build - Task $buildTaskName - File $script :buildScript.Definition @taskParameters
69
78
} | Should -Not - Throw
79
+
80
+ Assert-MockCalled - CommandName Set-Content - ParameterFilter {
81
+ $Path -eq " $ ( $TestDrive.FullName ) /WikiContent/Credential-overview.md"
82
+ } - Exactly - Times 1 - Scope It
70
83
}
71
84
}
You can’t perform that action at this time.
0 commit comments