Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Sources/FeedKit/Feeds/Atom/AtomFeedContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
import Foundation
import XMLKit

public struct AtomFeedContentAttributes: Codable, Equatable, Hashable, Sendable {
public struct AtomFeedContentAttributes: Equatable, Hashable, Sendable {
// MARK: Lifecycle

public init(
type: String? = nil,
src: String? = nil
src: String? = nil,
base: String? = nil
) {
self.type = type
self.src = src
self.base = base
}

// MARK: Public
Expand All @@ -58,6 +60,17 @@ public struct AtomFeedContentAttributes: Codable, Equatable, Hashable, Sendable
/// if the server providing that content also provides a media type, the
/// server-provided media type is authoritative.
public var src: String?

/// The Base URI as defined by RFC 3986, provided via the xml:base attribute.
public var base: String?
}

extension AtomFeedContentAttributes: Codable {
private enum CodingKeys: String, CodingKey {
case type
case src
case base = "xml:base"
}
}

/// The "atom:content" element either contains or links to the content of
Expand Down
3 changes: 2 additions & 1 deletion Tests/FeedKitTests/Tests/AtomTests + Mocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ extension AtomTests {
text: "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><i>[Update: The Atom draft is finished.]</i></p></div>",
attributes: .init(
type: "xhtml",
src: "http://www.example.org/"
src: "http://www.example.org/",
base: "http://diveintomark.org/"
)
),
published: RFC3339DateFormatter().date(from: "2003-12-13T08:29:29-04:00"),
Expand Down
3 changes: 2 additions & 1 deletion Tests/FeedKitTests/Tests/FeedTests + Mocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ extension FeedTests {
text: "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><i>[Update: The Atom draft is finished.]</i></p></div>",
attributes: .init(
type: "xhtml",
src: "http://www.example.org/"
src: "http://www.example.org/",
base: "http://diveintomark.org/"
)
),
published: RFC3339DateFormatter().date(from: "2003-12-13T08:29:29-04:00"),
Expand Down
Loading