fix(title): collapse double separators from empty placeholders - #4
Open
phlppschrr wants to merge 1 commit into
Open
Conversation
{pageNum} expands to an empty string on page 1, so formats like
{title}{separator}{pageNum}{separator}{site_name} render a double
separator ('Title | | Site') instead of the documented fallback
'Title | Site'. Collapse runs of two+ separators (whitespace between)
into a single separator before stripping leading/trailing ones.
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.
Problem
The module's title-format documentation (config field "Title format") promises that
{title}{separator}{pageNum}{separator}{site_name}falls back toTitle | Siteon the first page. It doesn't:{pageNum}expands to an empty string on page 1, and___formatTitle()only strips separators at the start/end — so page 1 rendersTitle | | Site.No format string can express the documented behavior: any format that yields
Title | Page 2 | Siteon page 2+ necessarily leaves a double separator on page 1.Fix
Collapse runs of two+ separators (separated only by whitespace) into a single separator before the existing leading/trailing strip:
A single separator between real values is never touched, so titles containing the separator (
History | Overview) are unaffected.