Improved feed library with comments, bug fixes and code factorization.
This commit is contained in:
@@ -48,7 +48,7 @@ feature -- Access
|
||||
then
|
||||
l_title := t
|
||||
create Result.make (l_title)
|
||||
Result.set_description (xml_element_text (x_feed, "subtitle"))
|
||||
Result.set_description (xml_element_text (x_feed, "subtitle"), "plain")
|
||||
Result.set_id (xml_element_text (x_feed, "id"))
|
||||
Result.set_updated_date_with_text (xml_element_text (x_feed, "updated"))
|
||||
if attached links_from_xml (x_feed, "link") as l_links then
|
||||
|
||||
@@ -10,20 +10,13 @@ inherit
|
||||
FEED_VISITOR
|
||||
|
||||
FEED_GENERATOR
|
||||
rename
|
||||
process_feed as visit_feed
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_buffer: STRING_8)
|
||||
do
|
||||
buffer := a_buffer
|
||||
create indentation.make_empty
|
||||
end
|
||||
|
||||
buffer: STRING_8
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED}."
|
||||
author: ""
|
||||
description: "FEED interface, could be RSS, ATOM, ..."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -30,6 +29,10 @@ feature -- Access
|
||||
description: detachable IMMUTABLE_STRING_32
|
||||
-- Associated description/subtitle.
|
||||
|
||||
description_content_type: detachable READABLE_STRING_8
|
||||
-- Optional content type for `description'.
|
||||
-- By default, this should be text/plain.
|
||||
|
||||
id: detachable IMMUTABLE_STRING_32
|
||||
-- Id associated with Current feed if any.
|
||||
|
||||
@@ -44,12 +47,15 @@ feature -- Access
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_description (a_description: detachable READABLE_STRING_GENERAL)
|
||||
set_description (a_description: detachable READABLE_STRING_GENERAL; a_description_content_type: like description_content_type)
|
||||
-- Set `description' with `a_description' and optional content type `text:$a_description_content_type'.
|
||||
do
|
||||
if a_description = Void then
|
||||
description := Void
|
||||
description_content_type := Void
|
||||
else
|
||||
create description.make_from_string_general (a_description)
|
||||
description_content_type := a_description_content_type
|
||||
end
|
||||
end
|
||||
|
||||
@@ -83,6 +89,4 @@ feature -- Visitor
|
||||
vis.visit_feed (Current)
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_AUTHOR}."
|
||||
author: ""
|
||||
description: "Object representing author of Feed or feed entry."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_ENTRY}."
|
||||
author: ""
|
||||
description: "Item of feed."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -170,6 +169,4 @@ feature -- Visitor
|
||||
vis.visit_entry (Current)
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_LINK}."
|
||||
author: ""
|
||||
description: "Link mentioned in feed and feed entry."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -21,10 +20,13 @@ feature {NONE} -- Initialization
|
||||
feature -- Access
|
||||
|
||||
href: READABLE_STRING_8
|
||||
-- Location of Current link.
|
||||
|
||||
relation: READABLE_STRING_32
|
||||
-- Relation associated with Current link.
|
||||
|
||||
type: detachable READABLE_STRING_8
|
||||
-- Optional type of link.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ feature -- Access
|
||||
if attached x_rss.element_by_name ("channel") as x_channel then
|
||||
if attached xml_element_text (x_channel, "title") as x_title then
|
||||
create Result.make (x_title)
|
||||
Result.set_description (xml_element_text (x_channel, "description"))
|
||||
Result.set_description (xml_element_text (x_channel, "description"), "xhtml")
|
||||
Result.set_updated_date_with_text (xml_element_text (x_channel, "lastBuildDate"))
|
||||
if attached links_from_xml (x_channel, "link") as l_links then
|
||||
across
|
||||
|
||||
@@ -10,20 +10,13 @@ inherit
|
||||
FEED_VISITOR
|
||||
|
||||
FEED_GENERATOR
|
||||
rename
|
||||
process_feed as visit_feed
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_buffer: STRING_8)
|
||||
do
|
||||
buffer := a_buffer
|
||||
initialize
|
||||
end
|
||||
|
||||
buffer: STRING_8
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_GENERATOR}."
|
||||
author: ""
|
||||
description: "Common ancestor for feed generator."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -10,13 +9,28 @@ deferred class
|
||||
inherit
|
||||
XML_UTILITIES
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
make (a_buffer: STRING_8)
|
||||
do
|
||||
buffer := a_buffer
|
||||
create indentation.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
buffer: STRING_8
|
||||
-- Output of feed conversion.
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
process_feed (a_feed: FEED)
|
||||
-- Convert `a_feed' into string representation in `buffer'.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
indent
|
||||
do
|
||||
indentation.append ("%T")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {FEED_VISITOR}."
|
||||
author: ""
|
||||
description: "Interface to visit Feed objects."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ echo Install library: openid
|
||||
|
||||
echo Install library: uri_template
|
||||
%COPYCMD% %TMP_DIR%\library\text\parser\uri_template %TMP_CONTRIB_DIR%\library\text\parser\uri_template
|
||||
echo Install library: feed
|
||||
%COPYCMD% %TMP_DIR%\library\text\parser\feed %TMP_CONTRIB_DIR%\library\text\parser\feed
|
||||
|
||||
echo Install library: notification_email
|
||||
%SAFE_MD% %TMP_CONTRIB_DIR%\library\runtime
|
||||
|
||||
@@ -65,6 +65,8 @@ echo Uninstall library: security\openid
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\web\authentication\openid
|
||||
echo Uninstall library: uri_template
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\text\parser\uri_template
|
||||
echo Uninstall library: feed
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\text\parser\feed
|
||||
echo Uninstall library: runtime\process\notification_email
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\runtime\process\notification_email
|
||||
|
||||
|
||||
Reference in New Issue
Block a user