Repository navigation
Fix: Fix conversion of subpages of pages with titles ending with a period - #196
Open
El1as42 wants to merge 2 commits into
Conversation
…riod Windows strips trailing periods (and spaces) from file and folder names. A page titled e.g. `Mult. Diff.` had its subpage folder created as `Mult.-Diff` by `New-Item` and pandoc, but on Powershell 5 its subpages were then read via the long path `\?\...\Mult.-Diff.\subpage.md`, which does not strip the period. This failed with `Cannot find path ... because it does not exist`, leaving image references and markdown content unprocessed. Now trailing periods and spaces are removed from file and folder names, including names truncated by `$mdFileNameAndFolderNameMaxLength`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t mutation fails Some exceptions do not mention the file path (e.g. when Windows Defender blocks a file: `Operation did not complete successfully because the file contains a virus or potentially unwanted software`), making it impossible to tell which page failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #197
Subpages fail to convert when their parent page's title ends with a period (e.g.
Mult. Diff.).Cause: Windows strips trailing periods from file and folder names. The subpage folder is created as
Mult.-DiffbyNew-Itemand pandoc, but on Powershell 5 the.mdis then read via the long path\\?\...\Mult.-Diff.\Extrema.md, which keeps the period. Every subpage then fails with:These pages end up with no heading and broken image references.
Changes
Remove-InvalidFileNameChars: remove trailing periods and spaces.Truncate-PathFileName: remove trailing periods and spaces left by truncation ($mdFileNameAndFolderNameMaxLength).Failed to mutate markdown contenterror, since some exceptions (e.g. Windows Defender blocking a file) don't mention it.Tests: unit tests for both functions, a
New-SectionGroupConversionConfigtest with a page and subpage whose titles end with a period, and a test for the error message. The new trailing-period tests fail without the fix. Unit tests pass on Windows PowerShell 5.1 and PowerShell 7.0. In this repo's CI (run on my fork), all jobs that can currently run pass: Windows PowerShell 5.1 (windows-2022) and PowerShell 7.1 to 7.4. The other jobs currently fail for any PR, before checkout: thewindows-2019runner image was retired, and the PowerShell 6.0 to 7.0 container images are too old foractions/checkout(GLIBC_2.28' not found).🤖 Generated with Claude Code