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
7 changes: 5 additions & 2 deletions build/Publish-Module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ if (-not $match.Success -or -not $match.Groups['notes'].Value.Trim()) {
$notes = ($match.Groups['notes'].Value -replace '(?m)^\[[^\]]+\]:\s*\S+\s*$', '').Trim()

# the built manifest carries the notes (the gallery shows them); the source keeps its link.
# Update-ModuleManifest writes them safely (quotes, several lines) and can run again.
Update-ModuleManifest -Path $manifestPath -ReleaseNotes $notes
# Update-ModuleManifest writes them safely (quotes, several lines) and can run again. It doubles ' in
# its single-quoted string but not the typographic single quotes U+2018 to U+201B, which PowerShell
# reads as quotes too; doubled, each stays one character.
$manifestNotes = $notes -replace '([\u2018\u2019\u201A\u201B])', '$1$1'
Update-ModuleManifest -Path $manifestPath -ReleaseNotes $manifestNotes
# the GitHub release takes the same text and names where the module is installed from
$releaseNotes = "{0}`n`nIn the PowerShell Gallery: {1}" -f $notes, ($galleryPackageUrl -f $Module, $Version)
Set-Content -LiteralPath (Join-Path $OutputPath "$Module-$Version.notes.md") -Value $releaseNotes -Encoding utf8NoBOM
Expand Down
13 changes: 13 additions & 0 deletions tests/powershell/Publish-Module.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,17 @@ Describe 'Publish-Module.ps1 release notes' {
}
finally { Remove-Item -LiteralPath $root -Recurse -Force }
}
It 'keeps typographic single quotes, which PowerShell also reads as quotes' {
$q = [char]0x2019
$root = Initialize-ReleaseFixture "## [1.2.3]`n`n- A folder of ``O${q}Neil`` and ${q}quoted${q}.`n"
try {
$script = Join-Path $root 'build' 'Publish-Module.ps1'
& $script -Module Demo.Module -Version 1.2.3 6>$null | Out-Null
& $script -Module Demo.Module -Version 1.2.3 6>$null | Out-Null
$notes = (Import-PowerShellDataFile (Join-Path $root 'output' 'Demo.Module' '1.2.3' 'Demo.Module.psd1')).PrivateData.PSData.ReleaseNotes
$notes | Should -BeExactly "- A folder of ``O${q}Neil`` and ${q}quoted${q}."
(Get-Content (Join-Path $root 'output' 'Demo.Module-1.2.3.notes.md') -Raw) | Should -BeLike "*O${q}Neil*"
}
finally { Remove-Item -LiteralPath $root -Recurse -Force }
}
}
Loading