Update to latest RSCore

Update use of OMPLString().
This commit is contained in:
Nate Weaver 2020-01-13 22:20:20 -06:00
parent 59de1edbfa
commit 6eac3781ba
11 changed files with 19 additions and 19 deletions

View File

@ -1261,13 +1261,13 @@ extension Account {
extension Account: OPMLRepresentable {
public func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
public func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
var s = ""
for feed in topLevelWebFeeds.sorted() {
s += feed.OPMLString(indentLevel: indentLevel + 1, strictConformance: strictConformance)
s += feed.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: allowCustomAttributes)
}
for folder in folders!.sorted() {
s += folder.OPMLString(indentLevel: indentLevel + 1, strictConformance: strictConformance)
s += folder.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: allowCustomAttributes)
}
return s
}

View File

@ -173,10 +173,10 @@ private extension Folder {
extension Folder: OPMLRepresentable {
public func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
public func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
let attrExternalID: String = {
if !strictConformance, let externalID = externalID {
if allowCustomAttributes, let externalID = externalID {
return " nnw_externalID=\"\(externalID)\""
} else {
return ""
@ -190,7 +190,7 @@ extension Folder: OPMLRepresentable {
var hasAtLeastOneChild = false
for feed in topLevelWebFeeds.sorted() {
s += feed.OPMLString(indentLevel: indentLevel + 1, strictConformance: strictConformance)
s += feed.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: allowCustomAttributes)
hasAtLeastOneChild = true
}

View File

@ -138,7 +138,7 @@ private extension OPMLFile {
"""
let middleText = account.OPMLString(indentLevel: 0, strictConformance: false)
let middleText = account.OPMLString(indentLevel: 0, allowCustomAttributes: true)
let closingText =
"""

View File

@ -245,7 +245,7 @@ public final class WebFeed: Feed, Renamable, Hashable {
extension WebFeed: OPMLRepresentable {
public func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
public func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
// https://github.com/brentsimmons/NetNewsWire/issues/527
// Dont use nameForDisplay because that can result in a feed name "Untitled" written to disk,
// which NetNewsWire may take later to be the actual name.

View File

@ -32,7 +32,7 @@ struct NNW3Document {
extension NNW3Document: OPMLRepresentable {
func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
var s =
"""
<?xml version="1.0" encoding="UTF-8"?>
@ -46,7 +46,7 @@ extension NNW3Document: OPMLRepresentable {
if let children = children {
for child in children {
s += child.OPMLString(indentLevel: indentLevel + 1, strictConformance: true)
s += child.OPMLString(indentLevel: indentLevel + 1)
}
}
@ -94,7 +94,7 @@ private struct NNW3Folder {
extension NNW3Folder: OPMLRepresentable {
func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
guard let children = children else {
// Empty folder.
@ -103,7 +103,7 @@ extension NNW3Folder: OPMLRepresentable {
var s = "<outline text=\"\(t)\" title=\"\(t)\">\n".rs_string(byPrependingNumberOfTabs: indentLevel)
for child in children {
s += child.OPMLString(indentLevel: indentLevel + 1, strictConformance: true)
s += child.OPMLString(indentLevel: indentLevel + 1)
}
s += "</outline>\n".rs_string(byPrependingNumberOfTabs: indentLevel)
@ -130,7 +130,7 @@ private struct NNW3Feed {
extension NNW3Feed: OPMLRepresentable {
func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
let p = homePageURL?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
let f = feedURL?.rs_stringByEscapingSpecialXMLCharacters() ?? ""

View File

@ -93,7 +93,7 @@ private extension NNW3ImportController {
guard let document = NNW3Document(subscriptionsPlistURL: url) else {
return nil
}
let opml = document.OPMLString(indentLevel: 0, strictConformance: true)
let opml = document.OPMLString(indentLevel: 0)
let opmlURL = FileManager.default.temporaryDirectory.appendingPathComponent("NNW3.opml")
do {

View File

@ -150,7 +150,7 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
@objc(opmlRepresentation)
var opmlRepresentation:String {
return self.account.OPMLString(indentLevel:0, strictConformance: true)
return self.account.OPMLString(indentLevel:0)
}
@objc(accountType)

View File

@ -110,7 +110,7 @@ class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObjectContai
@objc(opmlRepresentation)
var opmlRepresentation:String {
return self.folder.OPMLString(indentLevel:0, strictConformance: true)
return self.folder.OPMLString(indentLevel:0)
}
}

View File

@ -146,7 +146,7 @@ class ScriptableWebFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
@objc(opmlRepresentation)
var opmlRepresentation:String {
return self.webFeed.OPMLString(indentLevel:0, strictConformance: true)
return self.webFeed.OPMLString(indentLevel:0)
}
// MARK: --- scriptable elements ---

View File

@ -27,7 +27,7 @@ struct OPMLExporter {
"""
let middleText = account.OPMLString(indentLevel: 0, strictConformance: true)
let middleText = account.OPMLString(indentLevel: 0)
let closingText =
"""

@ -1 +1 @@
Subproject commit 2eca01e52f7b722b25523d46d2341baa54dca6d1
Subproject commit cd379dbbb8a0574e111b9846685a1d43006367f7