From 4ce641b1501f857d9ad7646b67f3dda5b6b17ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20R=C3=B6nnqvist?= Date: Fri, 5 Dec 2025 11:59:51 +0100 Subject: [PATCH] Use unicode literals to clarify that 3 different characters are added to the set --- Sources/DocCHTML/MarkdownRenderer.swift | 2 +- .../Link Resolution/PathHierarchyBasedLinkResolver.swift | 2 +- Sources/SwiftDocC/Model/Identifier.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/DocCHTML/MarkdownRenderer.swift b/Sources/DocCHTML/MarkdownRenderer.swift index 8ee60d8db9..14d28f2e2d 100644 --- a/Sources/DocCHTML/MarkdownRenderer.swift +++ b/Sources/DocCHTML/MarkdownRenderer.swift @@ -844,7 +844,7 @@ private extension CharacterSet { .union(CharacterSet(charactersIn: "`")) // Also consider back-ticks as punctuation. They are used as quotes around symbols or other code. .subtracting(CharacterSet(charactersIn: "-")) // Don't remove hyphens. They are used as a whitespace replacement. static let whitespaceAndDashes = CharacterSet.whitespaces - .union(CharacterSet(charactersIn: "-–—")) // hyphen, en dash, em dash + .union(CharacterSet(charactersIn: "-\u{2013}\u{2014}")) // hyphen, en dash, em dash } /// Creates a more readable version of a fragment by replacing characters that are not allowed in the fragment of a URL with hyphens. diff --git a/Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchyBasedLinkResolver.swift b/Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchyBasedLinkResolver.swift index 1bac256aab..7d134981a6 100644 --- a/Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchyBasedLinkResolver.swift +++ b/Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchyBasedLinkResolver.swift @@ -337,7 +337,7 @@ private func linkName(filename: some StringProtocol) -> String { } private let whitespaceAndDashes = CharacterSet.whitespaces - .union(CharacterSet(charactersIn: "-–—")) // hyphen, en dash, em dash + .union(CharacterSet(charactersIn: "-\u{2013}\u{2014}")) // hyphen, en dash, em dash private extension PathHierarchy.Node { func matches(languagesFilter: SmallSourceLanguageSet) -> Bool { diff --git a/Sources/SwiftDocC/Model/Identifier.swift b/Sources/SwiftDocC/Model/Identifier.swift index b6f66561f2..2e62153f28 100644 --- a/Sources/SwiftDocC/Model/Identifier.swift +++ b/Sources/SwiftDocC/Model/Identifier.swift @@ -642,7 +642,7 @@ private extension CharacterSet { .union(CharacterSet(charactersIn: "`")) // Also consider back-ticks as punctuation. They are used as quotes around symbols or other code. .subtracting(CharacterSet(charactersIn: "-")) // Don't remove hyphens. They are used as a whitespace replacement. static let whitespaceAndDashes = CharacterSet.whitespaces - .union(CharacterSet(charactersIn: "-–—")) // hyphen, en dash, em dash + .union(CharacterSet(charactersIn: "-\u{2013}\u{2014}")) // hyphen, en dash, em dash } /// Creates a more readable version of a fragment by replacing characters that are not allowed in the fragment of a URL with hyphens.