From deb8cf0d183e6936526ff5e0e0f1126d6210a038 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 16 Nov 2024 01:31:38 +0100 Subject: [PATCH] Clarify usage of `src` attribute. --- CHANGELOG.md | 1 + src/content.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e48d967..7a0fc1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Remove ambiguous statements about escaping from documentation. [`#85`](https://github.com/rust-syndication/atom/pull/85) - Update `quick-xml` to `0.37`. [`#86`](https://github.com/rust-syndication/atom/pull/86) +- Clarify usage of `src` attribute of a `Content` structure. [`#87`](https://github.com/rust-syndication/atom/pull/87) ## 0.12.4 - 2024-08-28 diff --git a/src/content.rs b/src/content.rs index d821c0e..280e8ea 100644 --- a/src/content.rs +++ b/src/content.rs @@ -12,6 +12,17 @@ use crate::toxml::ToXml; use crate::util::{atom_text, atom_xhtml, attr_value, decode}; /// Represents the content of an Atom entry +// +/// ## Attention +/// +/// Atom format specification [RFC4287](https://datatracker.ietf.org/doc/html/rfc4287#section-4.1.3.2) +/// states that `src` and `value` (content) fields are mutually exclusive: +/// +/// > atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. +/// > If the "src" attribute is present, atom:content MUST be empty. +/// +/// Setting of both fields when authoring an Atom feed is still technically possible, +/// but it will lead to a non-compliant result. #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[derive(Debug, Default, Clone, PartialEq)] #[cfg_attr(feature = "builders", derive(Builder))]