From 26abde585923dc7aa4d7345e9ad5cdef3cd697c0 Mon Sep 17 00:00:00 2001 From: Chris Jenkins Date: Mon, 19 Jan 2026 17:06:18 +0000 Subject: [PATCH] Added base attribute --- .../FeedKit/Feeds/Atom/AtomFeedContent.swift | 17 +++++++++++++++-- .../FeedKitTests/Tests/AtomTests + Mocks.swift | 3 ++- .../FeedKitTests/Tests/FeedTests + Mocks.swift | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Sources/FeedKit/Feeds/Atom/AtomFeedContent.swift b/Sources/FeedKit/Feeds/Atom/AtomFeedContent.swift index b0283c5..20dc0bd 100644 --- a/Sources/FeedKit/Feeds/Atom/AtomFeedContent.swift +++ b/Sources/FeedKit/Feeds/Atom/AtomFeedContent.swift @@ -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 @@ -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 diff --git a/Tests/FeedKitTests/Tests/AtomTests + Mocks.swift b/Tests/FeedKitTests/Tests/AtomTests + Mocks.swift index ee20ef1..da8cdd3 100644 --- a/Tests/FeedKitTests/Tests/AtomTests + Mocks.swift +++ b/Tests/FeedKitTests/Tests/AtomTests + Mocks.swift @@ -184,7 +184,8 @@ extension AtomTests { text: "

[Update: The Atom draft is finished.]

", 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"), diff --git a/Tests/FeedKitTests/Tests/FeedTests + Mocks.swift b/Tests/FeedKitTests/Tests/FeedTests + Mocks.swift index 5faac52..821be3f 100644 --- a/Tests/FeedKitTests/Tests/FeedTests + Mocks.swift +++ b/Tests/FeedKitTests/Tests/FeedTests + Mocks.swift @@ -184,7 +184,8 @@ extension FeedTests { text: "

[Update: The Atom draft is finished.]

", 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"),