Skip to content

Commit

Permalink
Merge pull request #176 from ShaunLawrie/master
Browse files Browse the repository at this point in the history
Fix #175
  • Loading branch information
StartAutomating authored Mar 16, 2024
2 parents 75e579f + e2587c2 commit 4e9d2af
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### HelpOut 0.5.3:

* Save-MarkdownHelp:
* Fix saving markdown with Windows paths ( #175 )

Thanks @ShaunLawrie !

---

### HelpOut 0.5.2:

* Save-MarkdownHelp:
Expand Down
12 changes: 4 additions & 8 deletions HelpOut.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,20 @@
ModuleToProcess='HelpOut.psm1'
FormatsToProcess='HelpOut.format.ps1xml'
TypesToProcess='HelpOut.types.ps1xml'
ModuleVersion='0.5.2'
ModuleVersion='0.5.3'
PrivateData = @{
PSData = @{
ProjectURI = 'https://github.com/StartAutomating/HelpOut'
LicenseURI = 'https://github.com/StartAutomating/HelpOut/blob/master/LICENSE'

Tags = 'Markdown', 'Help','PowerShell'
ReleaseNotes = @'
### HelpOut 0.5.2:
### HelpOut 0.5.3:
* Save-MarkdownHelp:
* IncludeSubModule/-ExcludeSubModule ( #155 )
* -IncludePath ( #169 )
* -ExcludeFile aliases ( #168 )
* -ExcludeExtension ( #167 )
* Not Saving Files with colons ( #163 )
* Fix saving markdown with Windows paths ( #175 )
Thanks @PrzemyslawKlys !
Thanks @ShaunLawrie !
---
Expand Down
9 changes: 7 additions & 2 deletions HelpOut.types.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ $FilePath,
$View = 'PowerShell.Markdown.Help'
)

if ($filePath -match '[\<\>\|\?\*\:]') {
Write-Warning "Will not .Save to $filePath, because that path will not be readable on all operating systems."
$illegalCharacters = @('<', '>', '|', '?', '*', ':')
$illegalCharacterRegex = '[' + ($illegalCharacters | Foreach-Object { [regex]::Escape($_) }) + ']'
$illegalCharacterReadable = ($illegalCharacters | Foreach-Object { "`"$_`"" }) -join ', '

$filePathWithoutQualifier = Split-Path $filePath -NoQualifier
if ($filePathWithoutQualifier -match $illegalCharacterRegex) {
Write-Warning "Will not .Save to $filePath, because that path will not be readable on all operating systems. It cannot contain any of the characters $illegalCharacterReadable."
return
}

Expand Down
9 changes: 7 additions & 2 deletions Types/PowerShell.Markdown.Help/Save.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ $FilePath,
$View = 'PowerShell.Markdown.Help'
)

if ($filePath -match '[\<\>\|\?\*\:]') {
Write-Warning "Will not .Save to $filePath, because that path will not be readable on all operating systems."
$illegalCharacters = @('<', '>', '|', '?', '*', ':')
$illegalCharacterRegex = '[' + ($illegalCharacters | Foreach-Object { [regex]::Escape($_) }) + ']'
$illegalCharacterReadable = ($illegalCharacters | Foreach-Object { "`"$_`"" }) -join ', '

$filePathWithoutQualifier = Split-Path $filePath -NoQualifier
if ($filePathWithoutQualifier -match $illegalCharacterRegex) {
Write-Warning "Will not .Save to $filePath, because that path will not be readable on all operating systems. It cannot contain any of the characters $illegalCharacterReadable."
return
}

Expand Down

0 comments on commit 4e9d2af

Please sign in to comment.