mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-03 05:21:55 +01:00
29 lines
849 B
Swift
29 lines
849 B
Swift
|
//
|
||
|
// Feed+OPMLRepresentable.swift
|
||
|
// DataModel
|
||
|
//
|
||
|
// Created by Brent Simmons on 7/2/17.
|
||
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
import RSCore
|
||
|
|
||
|
extension Feed: OPMLRepresentable {
|
||
|
|
||
|
public func OPMLString(indentLevel: Int) -> String {
|
||
|
|
||
|
let escapedName = nameForDisplay.rs_stringByEscapingSpecialXMLCharacters()
|
||
|
var escapedHomePageURL = ""
|
||
|
if let homePageURL = homePageURL {
|
||
|
escapedHomePageURL = homePageURL.rs_stringByEscapingSpecialXMLCharacters()
|
||
|
}
|
||
|
let escapedFeedURL = url.rs_stringByEscapingSpecialXMLCharacters()
|
||
|
|
||
|
var s = "<outline text=\"\(escapedName)\" title=\"\(escapedName)\" description=\"\" type=\"rss\" version=\"RSS\" htmlUrl=\"\(escapedHomePageURL)\" xmlUrl=\"\(escapedFeedURL)\"/>\n"
|
||
|
s = s.rs_string(byPrependingNumberOfTabs: indentLevel)
|
||
|
|
||
|
return s
|
||
|
}
|
||
|
}
|