Changes
2 changed files (+50/-35)
-
-
@@ -84,6 +84,43 @@ case _isPassword = "is_password"} } private static func stripInternalLinks(text: String) -> String { var source = text[...] var components: [Substring] = [] while true { guard let starts = source.firstRange(of: "[[") else { components.append(source) break } guard let idEnds = source.firstIndex(of: "|") else { components.append(source) break } guard let ends = source.firstRange(of: "]]") else { components.append(source) break } guard starts.upperBound < idEnds, idEnds < ends.lowerBound else { components.append(source) break } components.append(source[..<starts.lowerBound]) components.append(source[source.index(after: idEnds)..<ends.lowerBound]) if ends.upperBound >= source.index(before: source.endIndex) { break } source = source[ends.upperBound...] } return components.joined() } public struct Item: Codable, Hashable, Sendable { public let title: String public let subtitle: String?
-
@@ -125,40 +162,7 @@ guard let subtitle = subtitle else {return nil } var source = subtitle[...] var components: [Substring] = [] while true { guard let starts = source.firstRange(of: "[[") else { components.append(source) break } guard let idEnds = source.firstIndex(of: "|") else { components.append(source) break } guard let ends = source.firstRange(of: "]]") else { components.append(source) break } guard starts.upperBound < idEnds, idEnds < ends.lowerBound else { components.append(source) break } components.append(source[..<starts.lowerBound]) components.append(source[source.index(after: idEnds)..<ends.lowerBound]) if ends.upperBound >= source.index(before: source.endIndex) { break } source = source[ends.upperBound...] } return components.joined() return stripInternalLinks(text: subtitle) } }
-
@@ -223,6 +227,17 @@ case imageKey = "image_key"case _level = "level" case displayOffset = "display_offset" case hint = "hint" } /// Newer browsing pages, such as third-party cloud service's pages, *may* return /// `[[ID|label]]` formatted text for subtitle. As the text will be nearly unreadable, /// this helper getter function parses that and returns label part. The format is not specified. public var correctedSubtitle: String? { guard let subtitle = subtitle else { return nil } return stripInternalLinks(text: subtitle) } }
-
-
-
@@ -102,7 +102,7 @@ }} .navigationTitle(list.title) #if os(macOS) .navigationSubtitle(list.subtitle ?? "") .navigationSubtitle(list.correctedSubtitle ?? "") #endif } }
-