-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0de8805
commit 8cc80e0
Showing
22 changed files
with
356 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import Foundation | ||
import SyndiKit | ||
|
||
protocol BaseURLSite { | ||
/// A protocol representing a site with a base URL. | ||
public protocol BaseURLSite { | ||
/// The main URL of the site. | ||
var link: URL { get } | ||
|
||
/// The base URL of the blog, if available. | ||
var baseBlogURL: URL? { get } | ||
} | ||
|
||
extension BaseURLSite { | ||
/// The base URL of the site. | ||
public var baseURL: URL { | ||
baseBlogURL ?? link | ||
} | ||
} | ||
|
||
extension RSSChannel: BaseURLSite { | ||
var baseBlogURL: URL? { | ||
wpBaseBlogURL | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
Sources/ContributeWordPress/Decoder/PostsExportDecoder.swift
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
Sources/ContributeWordPress/Decoder/SitesExportDecoder.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Foundation | ||
import SyndiKit | ||
|
||
#if canImport(FoundationNetworking) | ||
import FoundationNetworking | ||
#endif | ||
|
||
/// A typealias that represents the section name for the blog | ||
public typealias SectionName = String | ||
|
||
/// A protocol for decoding WordPress sites from exports. | ||
public protocol SitesExportDecoder { | ||
/// Returns a dictionary of WordPress sites keyed by the filename of | ||
/// the export file as section name. | ||
/// | ||
/// - Parameter directoryURL: The URL of the directory containing the exports. | ||
/// - Returns: A dictionary of WordPress sites keyed by section name. | ||
/// - Throws: An error if sites couldn't be extracted from any of the export files. | ||
func sites(fromExportsAt directoryURL: URL) throws -> [SectionName: WordPressSite] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.