mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Merge branch 'master' of https://github.com/Ranchero-Software/NetNewsWire
This commit is contained in:
@@ -92,3 +92,38 @@ public extension Array where Element == Article {
|
||||
return map { $0.articleID }
|
||||
}
|
||||
}
|
||||
|
||||
public extension Article {
|
||||
private static let allowedTags: Set = ["b", "bdi", "bdo", "cite", "code", "del", "dfn", "em", "i", "ins", "kbd", "mark", "q", "s", "samp", "small", "strong", "sub", "sup", "time", "u", "var"]
|
||||
|
||||
func sanitizedTitle(forHTML: Bool = true) -> String? {
|
||||
guard let title = title else { return nil }
|
||||
|
||||
let scanner = Scanner(string: title)
|
||||
scanner.charactersToBeSkipped = nil
|
||||
var result = ""
|
||||
result.reserveCapacity(title.count)
|
||||
|
||||
while !scanner.isAtEnd {
|
||||
if let text = scanner.scanUpToString("<") {
|
||||
result.append(text)
|
||||
}
|
||||
|
||||
if let _ = scanner.scanString("<") {
|
||||
// All the allowed tags currently don't allow attributes
|
||||
if let tag = scanner.scanUpToString(">") {
|
||||
if Self.allowedTags.contains(tag.replacingOccurrences(of: "/", with: "")) {
|
||||
forHTML ? result.append("<\(tag)>") : result.append("")
|
||||
} else {
|
||||
forHTML ? result.append("<\(tag)>") : result.append("<\(tag)>")
|
||||
}
|
||||
|
||||
let _ = scanner.scanString(">")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ PROVISIONING_PROFILE_SPECIFIER =
|
||||
#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig"
|
||||
|
||||
SDKROOT = macosx
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0
|
||||
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ PROVISIONING_PROFILE_SPECIFIER =
|
||||
#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig"
|
||||
|
||||
SDKROOT = macosx
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0
|
||||
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ PROVISIONING_PROFILE_SPECIFIER =
|
||||
#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig"
|
||||
|
||||
SDKROOT = macosx
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0
|
||||
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator
|
||||
|
||||
@@ -18,7 +18,6 @@ SWIFT_VERSION = 5.1
|
||||
COMBINE_HIDPI_IMAGES = YES
|
||||
|
||||
COPY_PHASE_STRIP = NO
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
CURRENT_PROJECT_VERSION = 1
|
||||
VERSION_INFO_PREFIX =
|
||||
|
||||
Reference in New Issue
Block a user