Added support for category in ATOM format (input and output).
This commit is contained in:
@@ -72,6 +72,13 @@ feature -- Visitor
|
|||||||
if attached a_entry.date as dt then
|
if attached a_entry.date as dt then
|
||||||
append_content_tag_to ("updated", Void, date_to_string (dt), buffer)
|
append_content_tag_to ("updated", Void, date_to_string (dt), buffer)
|
||||||
end
|
end
|
||||||
|
if attached a_entry.categories as cats then
|
||||||
|
across
|
||||||
|
cats as ic
|
||||||
|
loop
|
||||||
|
append_content_tag_to ("category", <<["term", ic.item]>>, Void, buffer)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
append_content_tag_to ("summary", Void, a_entry.description, buffer)
|
append_content_tag_to ("summary", Void, a_entry.description, buffer)
|
||||||
if attached a_entry.content as l_content then
|
if attached a_entry.content as l_content then
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ feature -- Access
|
|||||||
if attached x_entry.element_by_name ("content") as x_content then
|
if attached x_entry.element_by_name ("content") as x_content then
|
||||||
e.set_content (xml_element_code (x_content), xml_attribute_text (x_content, "type"))
|
e.set_content (xml_element_code (x_content), xml_attribute_text (x_content, "type"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if attached x_entry.element_by_name ("author") as x_author then
|
if attached x_entry.element_by_name ("author") as x_author then
|
||||||
if attached x_author.element_by_name ("name") as x_name and then
|
if attached x_author.element_by_name ("name") as x_name and then
|
||||||
attached x_name.text as l_author_name
|
attached x_name.text as l_author_name
|
||||||
@@ -92,6 +93,17 @@ feature -- Access
|
|||||||
e.set_author (l_author)
|
e.set_author (l_author)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Optional "category"
|
||||||
|
if attached x_entry.elements_by_name ("category") as x_categories then
|
||||||
|
across
|
||||||
|
x_categories as cats_ic
|
||||||
|
loop
|
||||||
|
if attached xml_attribute_text (cats_ic.item, "term") as l_term then
|
||||||
|
e.set_category (l_term)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Result.extend (e)
|
Result.extend (e)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ feature {NONE} -- Helpers
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if a_content = Void then
|
if a_content = Void then
|
||||||
a_output.append ("/>")
|
a_output.append ("/>%N")
|
||||||
else
|
else
|
||||||
a_output.append (">")
|
a_output.append (">")
|
||||||
a_output.append (escaped_unicode_xml (a_content.as_string_32))
|
a_output.append (escaped_unicode_xml (a_content.as_string_32))
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ feature {NONE} -- Data
|
|||||||
<name>John Doe</name>
|
<name>John Doe</name>
|
||||||
<email>johndoe@example.com</email>
|
<email>johndoe@example.com</email>
|
||||||
</author>
|
</author>
|
||||||
|
<category term="foo"/><category term="bar"/>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|||||||
Reference in New Issue
Block a user