Compare commits
18 Commits
ewf_http_d
...
es_rev_979
| Author | SHA1 | Date | |
|---|---|---|---|
| 061e88c9fe | |||
| 66f204b1f2 | |||
| c92b1b8c3b | |||
| 98c12b8fb9 | |||
| 5fee483fd9 | |||
| f7a7afccd6 | |||
| e2c70e6d70 | |||
| a5e150d1c0 | |||
| 39887c8bdb | |||
|
|
1f1e2abbda | ||
| 1796d9631f | |||
| 389975e409 | |||
| 6c51590369 | |||
|
|
cc65bae644 | ||
|
|
c824f707cf | ||
| f0cba1d536 | |||
| ed891546bc | |||
| d0836d49a4 |
@@ -122,8 +122,8 @@ feature {NONE} -- Internal
|
||||
feature -- Conversion to string
|
||||
|
||||
yyyy_mmm_dd_string: STRING
|
||||
-- String representation YYYY mmm dd
|
||||
-- 2012 Dec 25
|
||||
-- String representation [YYYY mmm dd]
|
||||
-- ex: 2012 Dec 25
|
||||
do
|
||||
create Result.make (11)
|
||||
append_date_time_to_yyyy_mmm_dd_string (date_time, Result)
|
||||
@@ -131,7 +131,8 @@ feature -- Conversion to string
|
||||
|
||||
rfc1123_string: STRING
|
||||
-- String representation following RFC 1123.
|
||||
--| Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
|
||||
-- format: [ddd, dd mmm yyyy hh:mi:ss GMT]
|
||||
-- ex: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
|
||||
local
|
||||
s: like internal_rfc1123_string
|
||||
do
|
||||
@@ -145,7 +146,8 @@ feature -- Conversion to string
|
||||
end
|
||||
|
||||
rfc850_string: STRING
|
||||
-- String representation following RFC 850
|
||||
-- String representation following RFC 850.
|
||||
-- format: [mmm, dd-mmm-yy hh:mi:ss GMT]
|
||||
do
|
||||
create Result.make (32)
|
||||
append_date_time_to_rfc850_string (date_time, Result)
|
||||
@@ -153,6 +155,7 @@ feature -- Conversion to string
|
||||
|
||||
ansi_c_string: STRING
|
||||
-- ANSI C's asctime() format
|
||||
--| Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
|
||||
do
|
||||
create Result.make (32)
|
||||
append_date_time_to_ansi_c_string (date_time, Result)
|
||||
@@ -161,74 +164,34 @@ feature -- Conversion to string
|
||||
feature -- Conversion into string
|
||||
|
||||
append_to_yyyy_mmm_dd_string (s: STRING_GENERAL)
|
||||
local
|
||||
dt: DATE_TIME
|
||||
-- Append `datetime' as [yyyy mmm dd] format to `s'.
|
||||
do
|
||||
dt := date_time
|
||||
append_integer_to (dt.year, s) -- yyyy
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_month_mmm_to (dt.month, s) -- mmm
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_2_digits_integer_to (dt.day, s) -- dd
|
||||
append_date_time_to_yyyy_mmm_dd_string (date_time, s)
|
||||
end
|
||||
|
||||
append_to_rfc1123_string (s: STRING_GENERAL)
|
||||
local
|
||||
dt: DATE_TIME
|
||||
-- Append `date_time' as [ddd, dd mmm yyyy hh:mi:ss GMT] format to `s'.
|
||||
do
|
||||
dt := date_time
|
||||
append_day_ddd_to (dt.date.day_of_the_week, s) -- ddd
|
||||
s.append_code (44) -- 44 ',' -- ','
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_2_digits_integer_to (dt.day, s) -- dd
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_month_mmm_to (dt.month, s) -- mmm
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_integer_to (dt.year, s) -- YYYY
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_2_digits_time_to (dt.time, s) -- hh:mi:ss
|
||||
s.append (" GMT") -- SPace + GMT
|
||||
append_date_time_to_rfc1123_string (date_time, s)
|
||||
end
|
||||
|
||||
append_rfc850_string (s: STRING_GENERAL)
|
||||
local
|
||||
dt: DATE_TIME
|
||||
-- Append `date_time' as [mmm, dd-mmm-yy hh:mi:ss GMT] format to `s'.
|
||||
do
|
||||
dt := date_time
|
||||
append_day_name_to (dt.date.day_of_the_week, s) -- mmm
|
||||
s.append_code (44) -- 44 ',' -- ','
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_2_digits_integer_to (dt.day, s) -- dd
|
||||
s.append_code (45) -- 45 '-' -- '-'
|
||||
append_month_mmm_to (dt.month, s) -- mmm
|
||||
s.append_code (45) -- 45 '-' -- '-'
|
||||
append_integer_to (dt.year \\ 100, s) -- yy
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_2_digits_time_to (dt.time, s) -- hh:mi:ss
|
||||
s.append (" GMT") -- SPace + GMT
|
||||
append_date_time_to_rfc850_string (date_time, s)
|
||||
end
|
||||
|
||||
append_to_ansi_c_string (s: STRING_GENERAL)
|
||||
-- Append `date_time' as ANSI C's asctime format to `s'.
|
||||
--| Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
|
||||
local
|
||||
dt: DATE_TIME
|
||||
do
|
||||
dt := date_time
|
||||
append_day_ddd_to (dt.date.day_of_the_week, s) -- ddd
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_month_mmm_to (dt.month, s) -- mmm
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_integer_to (dt.day, s) -- d
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_2_digits_time_to (dt.time, s) -- hh:mi:ss
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
append_integer_to (dt.year, s) -- yyyy
|
||||
append_date_time_to_ansi_c_string (date_time, s)
|
||||
end
|
||||
|
||||
feature -- Conversion into string
|
||||
|
||||
append_date_time_to_yyyy_mmm_dd_string (dt: DATE_TIME; s: STRING_GENERAL)
|
||||
-- Append `dt' as [yyyy mmm dd] format to `s'.
|
||||
do
|
||||
append_integer_to (dt.year, s) -- yyyy
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
@@ -238,6 +201,7 @@ feature -- Conversion into string
|
||||
end
|
||||
|
||||
append_date_time_to_rfc1123_string (dt: DATE_TIME; s: STRING_GENERAL)
|
||||
-- Append `dt' as [ddd, dd mmm yyyy hh:mi:ss GMT] format to `s'.
|
||||
do
|
||||
append_day_ddd_to (dt.date.day_of_the_week, s) -- ddd
|
||||
s.append_code (44) -- 44 ',' -- ','
|
||||
@@ -253,6 +217,7 @@ feature -- Conversion into string
|
||||
end
|
||||
|
||||
append_date_time_to_rfc850_string (dt: DATE_TIME; s: STRING_GENERAL)
|
||||
-- Append `dt' as [mmm, dd-mmm-yy hh:mi:ss GMT] format to `s'.
|
||||
do
|
||||
append_day_name_to (dt.date.day_of_the_week, s) -- mmm
|
||||
s.append_code (44) -- 44 ',' -- ','
|
||||
@@ -268,7 +233,8 @@ feature -- Conversion into string
|
||||
end
|
||||
|
||||
append_date_time_to_ansi_c_string (dt: DATE_TIME; s: STRING_GENERAL)
|
||||
--| Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
|
||||
-- Append `dt' as ANSI C's asctime format to `s'.
|
||||
-- Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
|
||||
do
|
||||
append_day_ddd_to (dt.date.day_of_the_week, s) -- ddd
|
||||
s.append_code (32) -- 32 ' ' -- SPace
|
||||
@@ -294,7 +260,7 @@ feature -- Status report
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
feature -- Helper routines.
|
||||
|
||||
append_2_digits_integer_to (i: INTEGER; s: STRING_GENERAL)
|
||||
require
|
||||
@@ -361,7 +327,7 @@ feature {NONE} -- Implementation
|
||||
when 5 then s.append ("May")
|
||||
when 6 then s.append ("Jun")
|
||||
when 7 then s.append ("Jul")
|
||||
when 8 then s.append ("Aou")
|
||||
when 8 then s.append ("Aug")
|
||||
when 9 then s.append ("Sep")
|
||||
when 10 then s.append ("Oct")
|
||||
when 11 then s.append ("Nov")
|
||||
@@ -487,7 +453,7 @@ feature {NONE} -- Implementation
|
||||
elseif l_mmm.same_string ("MAY") then l_mo := 05
|
||||
elseif l_mmm.same_string ("JUN") then l_mo := 06
|
||||
elseif l_mmm.same_string ("JUL") then l_mo := 07
|
||||
elseif l_mmm.same_string ("AOU") then l_mo := 08
|
||||
elseif l_mmm.same_string ("AUG") then l_mo := 08
|
||||
elseif l_mmm.same_string ("SEP") then l_mo := 09
|
||||
elseif l_mmm.same_string ("OCT") then l_mo := 10
|
||||
elseif l_mmm.same_string ("NOV") then l_mo := 11
|
||||
@@ -599,7 +565,11 @@ feature {NONE} -- Implementation
|
||||
t.extend (s[i].as_upper)
|
||||
i := i + 1
|
||||
end
|
||||
if t.same_string ("GMT") or t.same_string ("UTC") then
|
||||
if
|
||||
t.same_string ("GMT") -- for instance: GMT+0002
|
||||
or t.same_string ("UTC") -- for instance: UTC+0002
|
||||
or t.is_empty -- for instance: +0002
|
||||
then
|
||||
from until i > n or else not s[i].is_space loop i := i + 1 end
|
||||
if i <= n then
|
||||
t.wipe_out
|
||||
@@ -718,7 +688,7 @@ feature {NONE} -- Implementation
|
||||
elseif l_mmm.same_string ("MAY") then l_mo := 05
|
||||
elseif l_mmm.same_string ("JUN") then l_mo := 06
|
||||
elseif l_mmm.same_string ("JUL") then l_mo := 07
|
||||
elseif l_mmm.same_string ("AOU") then l_mo := 08
|
||||
elseif l_mmm.same_string ("AUG") then l_mo := 08
|
||||
elseif l_mmm.same_string ("SEP") then l_mo := 09
|
||||
elseif l_mmm.same_string ("OCT") then l_mo := 10
|
||||
elseif l_mmm.same_string ("NOV") then l_mo := 11
|
||||
@@ -905,7 +875,7 @@ feature {NONE} -- Implementation
|
||||
invariant
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -81,7 +81,7 @@ feature -- Element change
|
||||
-- Unset `http_server_name' value.
|
||||
do
|
||||
http_server_name := Void
|
||||
ensure
|
||||
ensure
|
||||
unset_http_server_name: http_server_name = Void
|
||||
end
|
||||
|
||||
@@ -202,11 +202,6 @@ feature -- SSL Helpers
|
||||
deferred
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_ssl_3
|
||||
-- Set `ssl_protocol' with `Ssl_3'.
|
||||
deferred
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||
deferred
|
||||
|
||||
@@ -27,11 +27,6 @@ feature -- SSL Helpers
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_ssl_3
|
||||
-- Set `ssl_protocol' with `Ssl_3'.
|
||||
do
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||
|
||||
@@ -41,12 +41,6 @@ feature -- SSL Helpers
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Ssl_23)
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_ssl_3
|
||||
-- Set `ssl_protocol' with `Ssl_3'.
|
||||
do
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Ssl_3)
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||
do
|
||||
|
||||
23
library/server/ewsgi/package.iron
Normal file
23
library/server/ewsgi/package.iron
Normal file
@@ -0,0 +1,23 @@
|
||||
package ewsgi
|
||||
|
||||
project
|
||||
ewsgi = "ewsgi-safe.ecf"
|
||||
ewsgi = "ewsgi.ecf"
|
||||
ewsgi_spec = "ewsgi_spec-safe.ecf"
|
||||
ewsgi_spec = "ewsgi_spec.ecf"
|
||||
connector_cgi = "connectors/cgi/cgi-safe.ecf"
|
||||
connector_cgi = "connectors/cgi/cgi.ecf"
|
||||
connector_libfcgi = "connectors/libfcgi/libfcgi-safe.ecf"
|
||||
connector_libfcgi = "connectors/libfcgi/libfcgi.ecf"
|
||||
connector_nino = "connectors/nino/nino-safe.ecf"
|
||||
connector_nino = "connectors/nino/nino.ecf"
|
||||
connector_null = "connectors/null/null-safe.ecf"
|
||||
connector_null = "connectors/null/null.ecf"
|
||||
|
||||
note
|
||||
title: EWSGI
|
||||
description: EWSGI specification, and a few connectors.
|
||||
tags: web, httpd, ewf
|
||||
license: Eiffel Forum v2
|
||||
|
||||
end
|
||||
@@ -93,7 +93,7 @@ feature -- Change
|
||||
set_checked_by_value (v)
|
||||
Precursor (v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
15
library/text/parser/feed/feed-safe.ecf
Normal file
15
library/text/parser/feed/feed-safe.ecf
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="feed" uuid="71364A69-1549-472E-AF78-FDA4FDA016EB" library_target="feed">
|
||||
<target name="feed">
|
||||
<root all_classes="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
||||
<library name="encoders" location="..\..\encoder\encoder-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
|
||||
<library name="xml_parser" location="$ISE_LIBRARY\library\text\parser\xml\parser\xml_parser-safe.ecf"/>
|
||||
<library name="xml_tree" location="$ISE_LIBRARY\library\text\parser\xml\tree\xml_tree-safe.ecf"/>
|
||||
<cluster name="src" location="src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
17
library/text/parser/feed/feed.ecf
Normal file
17
library/text/parser/feed/feed.ecf
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="feed" uuid="71364A69-1549-472E-AF78-FDA4FDA016EB" library_target="feed">
|
||||
<target name="feed">
|
||||
<root all_classes="true"/>
|
||||
<option void_safety="none">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
||||
<library name="encoders" location="..\..\encoder\encoder.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
|
||||
<library name="xml_parser" location="$ISE_LIBRARY\library\text\parser\xml\parser\xml_parser.ecf"/>
|
||||
<library name="xml_tree" location="$ISE_LIBRARY\library\text\parser\xml\tree\xml_tree.ecf"/>
|
||||
<cluster name="src" location="src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
186
library/text/parser/feed/src/atom/atom_feed_generator.e
Normal file
186
library/text/parser/feed/src/atom/atom_feed_generator.e
Normal file
@@ -0,0 +1,186 @@
|
||||
note
|
||||
description: "Convert a FEED into an ATOM content."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
ATOM_FEED_GENERATOR
|
||||
|
||||
inherit
|
||||
FEED_VISITOR
|
||||
|
||||
FEED_GENERATOR
|
||||
rename
|
||||
process_feed as visit_feed
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
do
|
||||
buffer.append ("[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
]")
|
||||
buffer.append_character ('%N')
|
||||
indent
|
||||
append_content_tag_to ("title", Void, a_feed.title, buffer)
|
||||
append_content_tag_to ("subtitle", Void, a_feed.description, buffer)
|
||||
if attached a_feed.id as l_id then
|
||||
append_content_tag_to ("id", Void, l_id, buffer)
|
||||
else
|
||||
append_content_tag_to ("id", Void, "urn:uuid:" + new_uuid, buffer)
|
||||
end
|
||||
|
||||
across
|
||||
a_feed.links as tb
|
||||
loop
|
||||
tb.item.accept (Current)
|
||||
end
|
||||
if attached a_feed.date as dt then
|
||||
append_content_tag_to ("updated", Void, date_to_string (dt), buffer)
|
||||
end
|
||||
across
|
||||
a_feed.items as ic
|
||||
loop
|
||||
ic.item.accept (Current)
|
||||
end
|
||||
|
||||
exdent
|
||||
buffer.append ("</feed>")
|
||||
end
|
||||
|
||||
visit_item (a_entry: FEED_ITEM)
|
||||
do
|
||||
buffer.append (indentation)
|
||||
buffer.append ("<entry>%N")
|
||||
indent
|
||||
append_content_tag_to ("title", Void, a_entry.title, buffer)
|
||||
across
|
||||
a_entry.links as tb
|
||||
loop
|
||||
tb.item.accept (Current)
|
||||
end
|
||||
if attached a_entry.id as l_id then
|
||||
append_content_tag_to ("id", Void, l_id, buffer)
|
||||
else
|
||||
append_content_tag_to ("id", Void, "urn:uuid:" + new_uuid, buffer)
|
||||
end
|
||||
if attached a_entry.date as dt then
|
||||
append_content_tag_to ("updated", Void, date_to_string (dt), buffer)
|
||||
end
|
||||
|
||||
append_content_tag_to ("summary", Void, a_entry.description, buffer)
|
||||
if attached a_entry.content as l_content then
|
||||
if attached a_entry.content_type_or_default ("xhtml").is_case_insensitive_equal_general ("xhtml") then
|
||||
-- if l_content.has_substring ("<div xmlns=%"http://www.w3.org/1999/xhtml%">") then
|
||||
append_content_tag_to ("content", <<["type", "xhtml"]>>, l_content, buffer)
|
||||
-- else
|
||||
-- append_content_tag_to ("content", <<["type", "xhtml"]>>, {STRING_32} "<div xmlns=%"http://www.w3.org/1999/xhtml%">" + l_content + {STRING_32} "</div>", buffer)
|
||||
-- end
|
||||
else
|
||||
append_content_tag_to ("content", <<["type", a_entry.content_type]>>, a_entry.content, buffer)
|
||||
end
|
||||
end
|
||||
|
||||
if attached a_entry.author as u then
|
||||
u.accept (Current)
|
||||
end
|
||||
exdent
|
||||
buffer.append (indentation)
|
||||
buffer.append ("</entry>%N")
|
||||
end
|
||||
|
||||
visit_link (a_link: FEED_LINK)
|
||||
local
|
||||
attr: detachable ARRAYED_LIST [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_32]]
|
||||
tu: TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_32]
|
||||
do
|
||||
create attr.make (2)
|
||||
if attached a_link.relation as rel and then not rel.is_whitespace then
|
||||
tu := ["rel", rel]
|
||||
attr.force (tu)
|
||||
end
|
||||
if attached a_link.type as t and then not t.is_whitespace then
|
||||
tu := ["type", t.as_string_32]
|
||||
attr.force (tu)
|
||||
end
|
||||
tu := ["href", a_link.href.as_string_32]
|
||||
attr.force (tu)
|
||||
if attr.is_empty then
|
||||
attr := Void
|
||||
end
|
||||
append_content_tag_to ("link", attr, Void, buffer)
|
||||
end
|
||||
|
||||
visit_author (a_author: FEED_AUTHOR)
|
||||
do
|
||||
buffer.append (indentation)
|
||||
buffer.append ("<author>%N")
|
||||
indent
|
||||
append_content_tag_to ("name", Void, a_author.name, buffer)
|
||||
append_content_tag_to ("email", Void, a_author.email, buffer)
|
||||
exdent
|
||||
buffer.append (indentation)
|
||||
buffer.append ("</author>%N")
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
new_uuid: STRING
|
||||
local
|
||||
gen: UUID_GENERATOR
|
||||
do
|
||||
create gen
|
||||
Result := gen.generate_uuid.out.as_lower
|
||||
end
|
||||
|
||||
date_to_string (dt: DATE_TIME): STRING
|
||||
do
|
||||
Result := date_to_rfc3339_string (dt)
|
||||
end
|
||||
|
||||
date_to_rfc3339_string (d: DATE_TIME): STRING
|
||||
-- 2003-12-13T18:30:02Z
|
||||
local
|
||||
i: INTEGER
|
||||
do
|
||||
create Result.make_empty
|
||||
Result.append_integer (d.year)
|
||||
Result.append_character ('-')
|
||||
i := d.month
|
||||
if i < 10 then
|
||||
Result.append_integer (0)
|
||||
end
|
||||
Result.append_integer (i)
|
||||
Result.append_character ('-')
|
||||
i := d.day
|
||||
if i < 10 then
|
||||
Result.append_integer (0)
|
||||
end
|
||||
Result.append_integer (i)
|
||||
Result.append_character ('T')
|
||||
i := d.hour
|
||||
if i < 10 then
|
||||
Result.append_integer (0)
|
||||
end
|
||||
Result.append_integer (i)
|
||||
Result.append_character (':')
|
||||
i := d.minute
|
||||
if i < 10 then
|
||||
Result.append_integer (0)
|
||||
end
|
||||
Result.append_integer (i)
|
||||
Result.append_character (':')
|
||||
i := d.second
|
||||
if i < 10 then
|
||||
Result.append_integer (0)
|
||||
end
|
||||
Result.append_integer (i)
|
||||
Result.append_character ('Z')
|
||||
end
|
||||
|
||||
end
|
||||
104
library/text/parser/feed/src/atom/atom_feed_parser.e
Normal file
104
library/text/parser/feed/src/atom/atom_feed_parser.e
Normal file
@@ -0,0 +1,104 @@
|
||||
note
|
||||
description: "[
|
||||
ATOM Parser.
|
||||
|
||||
Warning: the implementation may not support the full ATOM specification.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
EIS: "name=ATOM at wikipedia", "protocol=URI", "src=https://en.wikipedia.org/wiki/Atom_(standard)"
|
||||
EIS: "name=RSS at wikipedia", "protocol=URI", "src=https://en.wikipedia.org/wiki/RSS"
|
||||
EIS: "name=ATOM 1.0 RFC4287", "protocol=URI", "src=https://tools.ietf.org/html/rfc4287"
|
||||
|
||||
class
|
||||
ATOM_FEED_PARSER
|
||||
|
||||
inherit
|
||||
FEED_PARSER
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING = "atom1"
|
||||
-- Associated name.
|
||||
|
||||
is_detected (xdoc: XML_DOCUMENT): BOOLEAN
|
||||
-- Is `xdoc' an ATOM feed representation?
|
||||
do
|
||||
Result := attached {XML_ELEMENT} xdoc.element_by_name ("feed") as x_feed and then
|
||||
(
|
||||
not attached xml_attribute_text (x_feed, "xmlns") as l_xmlns
|
||||
or else l_xmlns.same_string ("http://www.w3.org/2005/Atom")
|
||||
)
|
||||
end
|
||||
|
||||
feed (xdoc: XML_DOCUMENT): detachable FEED
|
||||
-- Feed from `xdoc' XML document.
|
||||
local
|
||||
l_title: READABLE_STRING_32
|
||||
x_entry, x_link: detachable XML_ELEMENT
|
||||
e: FEED_ITEM
|
||||
l_author: FEED_AUTHOR
|
||||
lnk: FEED_LINK
|
||||
s: STRING_32
|
||||
do
|
||||
if
|
||||
attached xdoc.element_by_name ("feed") as x_feed and then
|
||||
-- (not attached xml_attribute_text (x_feed, "xmlns") as l_xmlns or else l_xmlns.same_string ("http://www.w3.org/2005/Atom"))
|
||||
attached xml_element_text (x_feed, "title") as t
|
||||
then
|
||||
l_title := t
|
||||
create Result.make (l_title)
|
||||
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
|
||||
across
|
||||
l_links as link_ic
|
||||
loop
|
||||
lnk := link_ic.item
|
||||
Result.links.force (lnk, lnk.relation)
|
||||
end
|
||||
end
|
||||
if attached x_feed.elements_by_name ("entry") as x_entries then
|
||||
across
|
||||
x_entries as ic
|
||||
loop
|
||||
x_entry := ic.item
|
||||
if attached xml_element_text (x_entry, "title") as e_title then
|
||||
create e.make (e_title)
|
||||
e.set_description (xml_element_text (x_entry, "summary"))
|
||||
e.set_id (xml_element_text (x_entry, "id"))
|
||||
e.set_updated_date_with_text (xml_element_text (x_entry, "updated"))
|
||||
|
||||
if attached links_from_xml (x_entry, "link") as l_links then
|
||||
across
|
||||
l_links as link_ic
|
||||
loop
|
||||
lnk := link_ic.item
|
||||
e.links.force (lnk, lnk.relation)
|
||||
end
|
||||
end
|
||||
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"))
|
||||
end
|
||||
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
|
||||
attached x_name.text as l_author_name
|
||||
then
|
||||
create l_author.make (l_author_name)
|
||||
if attached x_author.element_by_name ("email") as x_email then
|
||||
l_author.set_email (x_email.text)
|
||||
end
|
||||
e.set_author (l_author)
|
||||
end
|
||||
end
|
||||
Result.extend (e)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
69
library/text/parser/feed/src/feed_default_parsers.e
Normal file
69
library/text/parser/feed/src/feed_default_parsers.e
Normal file
@@ -0,0 +1,69 @@
|
||||
note
|
||||
description: "[
|
||||
Collection of default feed parsers provided by the current library.
|
||||
A new parser can be easily added via `parsers.extend (...)'.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_DEFAULT_PARSERS
|
||||
|
||||
inherit
|
||||
ANY
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
create
|
||||
default_create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
default_create
|
||||
do
|
||||
Precursor
|
||||
create {ARRAYED_LIST [FEED_PARSER]} parsers.make (2)
|
||||
parsers.force (create {RSS_2_FEED_PARSER})
|
||||
parsers.force (create {ATOM_FEED_PARSER})
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
parsers: LIST [FEED_PARSER]
|
||||
-- Available Feed parsers.
|
||||
|
||||
feature -- Access
|
||||
|
||||
feed_from_string (a_content: READABLE_STRING_8): detachable FEED
|
||||
-- Feed object from `a_content' string, if a parser is able to parse.it.
|
||||
local
|
||||
p: XML_STANDARD_PARSER
|
||||
cb_tree: XML_CALLBACKS_FILTER_DOCUMENT
|
||||
xdoc: XML_DOCUMENT
|
||||
do
|
||||
create p.make
|
||||
create cb_tree.make_null
|
||||
p.set_callbacks (cb_tree)
|
||||
p.parse_from_string_8 (a_content)
|
||||
if p.is_correct then
|
||||
xdoc := cb_tree.document
|
||||
Result := feed (xdoc)
|
||||
end
|
||||
end
|
||||
|
||||
feed (xdoc: XML_DOCUMENT): like feed_from_string
|
||||
-- Feed from `xdoc' XML document.
|
||||
do
|
||||
across
|
||||
parsers as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
if ic.item.is_detected (xdoc) then
|
||||
Result := ic.item.feed (xdoc)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
62
library/text/parser/feed/src/feed_parser.e
Normal file
62
library/text/parser/feed/src/feed_parser.e
Normal file
@@ -0,0 +1,62 @@
|
||||
note
|
||||
description: "[
|
||||
Interface common to any FEED parser.
|
||||
|
||||
Usage:
|
||||
create parser
|
||||
if attached parser.feed_from_string (l_feed_content) as l_feed then
|
||||
...
|
||||
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
FEED_PARSER
|
||||
|
||||
inherit
|
||||
FEED_PARSER_UTILITIES
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING
|
||||
-- Associated name.
|
||||
deferred
|
||||
ensure
|
||||
not_blanc: not Result.is_whitespace
|
||||
end
|
||||
|
||||
is_detected (xdoc: XML_DOCUMENT): BOOLEAN
|
||||
-- Is `xdoc' an feed representation or Current supported format?
|
||||
deferred
|
||||
end
|
||||
|
||||
feed (xdoc: XML_DOCUMENT): detachable FEED
|
||||
-- Feed from `xdoc' XML document.
|
||||
require
|
||||
is_detected: is_detected (xdoc)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
feed_from_string (a_content: READABLE_STRING_8): like feed
|
||||
-- Feed from `a_content' document.
|
||||
local
|
||||
p: XML_STANDARD_PARSER
|
||||
cb_tree: XML_CALLBACKS_FILTER_DOCUMENT
|
||||
xdoc: XML_DOCUMENT
|
||||
do
|
||||
create p.make
|
||||
create cb_tree.make_null
|
||||
p.set_callbacks (cb_tree)
|
||||
p.parse_from_string_8 (a_content)
|
||||
if p.is_correct then
|
||||
xdoc := cb_tree.document
|
||||
if is_detected (xdoc) then
|
||||
Result := feed (xdoc)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
159
library/text/parser/feed/src/kernel/feed.e
Normal file
159
library/text/parser/feed/src/kernel/feed.e
Normal file
@@ -0,0 +1,159 @@
|
||||
note
|
||||
description: "FEED interface, could be RSS, ATOM, ..."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED
|
||||
|
||||
inherit
|
||||
FEED_HELPERS
|
||||
|
||||
ITERABLE [FEED_ITEM]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_title: READABLE_STRING_GENERAL)
|
||||
do
|
||||
create title.make_from_string_general (a_title)
|
||||
create items.make (1)
|
||||
create links.make (1)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: IMMUTABLE_STRING_32
|
||||
-- Title of the feed/channel.
|
||||
|
||||
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.
|
||||
|
||||
date: detachable DATE_TIME
|
||||
-- Build date.
|
||||
|
||||
links: STRING_TABLE [FEED_LINK]
|
||||
-- Url indexed by relation
|
||||
|
||||
items: ARRAYED_LIST [FEED_ITEM]
|
||||
-- List of feed items.
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [FEED_ITEM]
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
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
|
||||
|
||||
set_id (a_id: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_id = Void then
|
||||
id := Void
|
||||
else
|
||||
create id.make_from_string_general (a_id)
|
||||
end
|
||||
end
|
||||
|
||||
set_updated_date_with_text (a_date_text: detachable READABLE_STRING_32)
|
||||
-- Set `date' from date string representation `a_date_text'.
|
||||
obsolete
|
||||
"Use set_date_with_text [oct/2015]"
|
||||
do
|
||||
set_date_with_text (a_date_text)
|
||||
end
|
||||
|
||||
set_date_with_text (a_date_text: detachable READABLE_STRING_32)
|
||||
-- Set `date' from date string representation `a_date_text'.
|
||||
do
|
||||
if a_date_text = Void then
|
||||
set_date (Void)
|
||||
else
|
||||
set_date (date_time (a_date_text))
|
||||
end
|
||||
end
|
||||
|
||||
set_date (a_date: detachable DATE_TIME)
|
||||
-- Set `date' from `a_date'.
|
||||
do
|
||||
date := a_date
|
||||
end
|
||||
|
||||
extend (a_item: FEED_ITEM)
|
||||
-- Add item `a_item' to feed `items'.
|
||||
do
|
||||
items.force (a_item)
|
||||
end
|
||||
|
||||
prune (a_item: FEED_ITEM)
|
||||
-- Remove feed item `a_item' from Current list of feed items.
|
||||
do
|
||||
items.prune (a_item)
|
||||
end
|
||||
|
||||
extended alias "+" (a_feed: FEED): FEED
|
||||
-- New feed object made from Current merged with a_feed.
|
||||
local
|
||||
l_title: STRING_32
|
||||
do
|
||||
create l_title.make (title.count + a_feed.title.count)
|
||||
l_title.append_character ('(')
|
||||
l_title.append (title)
|
||||
l_title.append_character (')')
|
||||
l_title.append_character ('+')
|
||||
l_title.append_character ('(')
|
||||
l_title.append (a_feed.title)
|
||||
l_title.append_character (')')
|
||||
create Result.make (l_title)
|
||||
Result.items.append (items)
|
||||
across
|
||||
a_feed.items as ic
|
||||
loop
|
||||
-- FIXME jfiat [2015/10/07] : check there is no duplication! (same id, or link, ...)
|
||||
Result.extend (ic.item)
|
||||
end
|
||||
Result.sort
|
||||
end
|
||||
|
||||
sort
|
||||
-- Sort `items', (recent first).
|
||||
local
|
||||
s: QUICK_SORTER [FEED_ITEM]
|
||||
comp: COMPARABLE_COMPARATOR [FEED_ITEM]
|
||||
do
|
||||
create comp
|
||||
create s.make (comp)
|
||||
s.reverse_sort (items)
|
||||
end
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
accept (vis: FEED_VISITOR)
|
||||
do
|
||||
vis.visit_feed (Current)
|
||||
end
|
||||
|
||||
end
|
||||
48
library/text/parser/feed/src/kernel/feed_author.e
Normal file
48
library/text/parser/feed/src/kernel/feed_author.e
Normal file
@@ -0,0 +1,48 @@
|
||||
note
|
||||
description: "[
|
||||
Author of feed or feed entry.
|
||||
- name and email information.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_AUTHOR
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: READABLE_STRING_GENERAL)
|
||||
do
|
||||
create name.make_from_string_general (a_name)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: IMMUTABLE_STRING_32
|
||||
|
||||
email: detachable READABLE_STRING_8
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_email (a_email: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_email = Void then
|
||||
email := Void
|
||||
elseif a_email.is_valid_as_string_8 then
|
||||
email := a_email.as_string_8
|
||||
else
|
||||
email := Void
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
accept (vis: FEED_VISITOR)
|
||||
do
|
||||
vis.visit_author (Current)
|
||||
end
|
||||
|
||||
end
|
||||
208
library/text/parser/feed/src/kernel/feed_item.e
Normal file
208
library/text/parser/feed/src/kernel/feed_item.e
Normal file
@@ -0,0 +1,208 @@
|
||||
note
|
||||
description: "[
|
||||
A feed contains a list of items.
|
||||
This FEED_ITEM interface provides
|
||||
- title, description, content, id, date, ...
|
||||
- could be compared with other item to sort by date+title.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_ITEM
|
||||
|
||||
inherit
|
||||
FEED_HELPERS
|
||||
undefine
|
||||
is_equal
|
||||
end
|
||||
|
||||
COMPARABLE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_title: READABLE_STRING_GENERAL)
|
||||
do
|
||||
create title.make_from_string_general (a_title)
|
||||
create links.make (1)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: IMMUTABLE_STRING_32
|
||||
-- Title of associated feed item.
|
||||
|
||||
description: detachable IMMUTABLE_STRING_32
|
||||
-- Optional description (or summary).
|
||||
|
||||
content: detachable IMMUTABLE_STRING_32
|
||||
-- Content of Current feed item.
|
||||
|
||||
content_type: detachable READABLE_STRING_8
|
||||
-- Optional content type for `content'.
|
||||
-- By default, this should be text/html.
|
||||
|
||||
content_type_or_default (dft: READABLE_STRING_8): READABLE_STRING_8
|
||||
-- Associated content type, and if none, return given value `dft'.
|
||||
do
|
||||
if attached content_type as l_type then
|
||||
Result := l_type
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
end
|
||||
|
||||
id: detachable IMMUTABLE_STRING_32
|
||||
-- Identifier of current feed item, if any/
|
||||
|
||||
date: detachable DATE_TIME
|
||||
-- Publishing date.
|
||||
|
||||
link: detachable FEED_LINK
|
||||
-- Main link for the entry, if any.
|
||||
do
|
||||
if attached links as l_links then
|
||||
Result := l_links.item ("")
|
||||
across
|
||||
l_links as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
Result := ic.item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
links: STRING_TABLE [FEED_LINK]
|
||||
-- Url indexed by relation
|
||||
|
||||
categories: detachable LIST [READABLE_STRING_32]
|
||||
-- Categories
|
||||
|
||||
author: detachable FEED_AUTHOR
|
||||
-- Author information.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has_category (cat: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Has category `cat'?
|
||||
--| note: case insensitive.
|
||||
do
|
||||
if attached categories as cats then
|
||||
Result := across cats as ic some cat.is_case_insensitive_equal (ic.item) end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
is_less alias "<" (other: like Current): BOOLEAN
|
||||
-- Is current object less than `other'?
|
||||
local
|
||||
d1,d2: like date
|
||||
do
|
||||
d1 := date
|
||||
d2 := other.date
|
||||
if d1 = Void and d2 = Void then
|
||||
Result := title < other.title
|
||||
elseif d1 = Void then
|
||||
Result := True
|
||||
elseif d2 = Void then
|
||||
Result := False
|
||||
else
|
||||
if d1 ~ d2 then
|
||||
Result := title < other.title
|
||||
else
|
||||
Result := d1 < d2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_id (a_id: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_id = Void then
|
||||
id := Void
|
||||
else
|
||||
create id.make_from_string_general (a_id)
|
||||
end
|
||||
end
|
||||
|
||||
set_description (a_description: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_description = Void then
|
||||
description := Void
|
||||
else
|
||||
create description.make_from_string_general (a_description)
|
||||
end
|
||||
end
|
||||
|
||||
set_content (a_content: detachable READABLE_STRING_GENERAL; a_type: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_content = Void then
|
||||
content := Void
|
||||
content_type := Void
|
||||
else
|
||||
create content.make_from_string_general (a_content)
|
||||
if a_type = Void then
|
||||
content_type := Void
|
||||
else
|
||||
content_type := a_type.as_string_8
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set_updated_date_with_text (a_date_text: detachable READABLE_STRING_32)
|
||||
-- Set `date' from date string representation `a_date_text'.
|
||||
obsolete
|
||||
"Use set_date_with_text [oct/2015]"
|
||||
do
|
||||
set_date_with_text (a_date_text)
|
||||
end
|
||||
|
||||
set_date_with_text (a_date_text: detachable READABLE_STRING_32)
|
||||
-- Set `date' from date string representation `a_date_text'.
|
||||
do
|
||||
if a_date_text = Void then
|
||||
set_date (Void)
|
||||
else
|
||||
set_date (date_time (a_date_text))
|
||||
end
|
||||
end
|
||||
|
||||
set_date (a_date: detachable DATE_TIME)
|
||||
-- Set `date' from `a_date'.
|
||||
do
|
||||
date := a_date
|
||||
end
|
||||
|
||||
set_author (a_author: detachable FEED_AUTHOR)
|
||||
do
|
||||
author := a_author
|
||||
end
|
||||
|
||||
set_category (cat: READABLE_STRING_GENERAL)
|
||||
local
|
||||
cats: like categories
|
||||
do
|
||||
cats := categories
|
||||
if cats = Void then
|
||||
create {ARRAYED_LIST [READABLE_STRING_32]} cats.make (1)
|
||||
categories := cats
|
||||
end
|
||||
cats.force (cat.as_string_32)
|
||||
ensure
|
||||
cat_set: has_category (cat)
|
||||
end
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
accept (vis: FEED_VISITOR)
|
||||
do
|
||||
vis.visit_item (Current)
|
||||
end
|
||||
|
||||
end
|
||||
58
library/text/parser/feed/src/kernel/feed_link.e
Normal file
58
library/text/parser/feed/src/kernel/feed_link.e
Normal file
@@ -0,0 +1,58 @@
|
||||
note
|
||||
description: "Link mentioned in feed and feed entry."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_LINK
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_href: READABLE_STRING_8)
|
||||
do
|
||||
href := a_href
|
||||
set_relation (Void)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
set_relation (rel: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if rel = Void then
|
||||
relation := ""
|
||||
else
|
||||
relation := rel.as_string_8
|
||||
end
|
||||
end
|
||||
|
||||
set_type (a_type: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_type = Void then
|
||||
type := Void
|
||||
else
|
||||
type := a_type.as_string_8
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
accept (vis: FEED_VISITOR)
|
||||
do
|
||||
vis.visit_link (Current)
|
||||
end
|
||||
|
||||
end
|
||||
126
library/text/parser/feed/src/rss/rss_2_feed_generator.e
Normal file
126
library/text/parser/feed/src/rss/rss_2_feed_generator.e
Normal file
@@ -0,0 +1,126 @@
|
||||
note
|
||||
description: "Convert a FEED into an RSS 2.0 content."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
RSS_2_FEED_GENERATOR
|
||||
|
||||
inherit
|
||||
FEED_VISITOR
|
||||
|
||||
FEED_GENERATOR
|
||||
rename
|
||||
process_feed as visit_feed
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
do
|
||||
buffer.append ("[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
version="2.0">
|
||||
<channel>
|
||||
]")
|
||||
buffer.append_character ('%N')
|
||||
indent
|
||||
indent
|
||||
append_content_tag_to ("title", Void, a_feed.title, buffer)
|
||||
append_content_tag_to ("description", Void, a_feed.description, buffer)
|
||||
across
|
||||
a_feed.links as tb
|
||||
loop
|
||||
tb.item.accept (Current)
|
||||
end
|
||||
if attached a_feed.date as dt then
|
||||
append_content_tag_to ("lastBuildDate", Void, date_to_string (dt), buffer)
|
||||
end
|
||||
across
|
||||
a_feed.items as ic
|
||||
loop
|
||||
ic.item.accept (Current)
|
||||
end
|
||||
exdent
|
||||
exdent
|
||||
buffer.append ("[
|
||||
</channel>
|
||||
</rss>
|
||||
]")
|
||||
end
|
||||
|
||||
visit_item (a_item: FEED_ITEM)
|
||||
do
|
||||
buffer.append (indentation)
|
||||
buffer.append ("<item>%N")
|
||||
indent
|
||||
append_content_tag_to ("title", Void, a_item.title, buffer)
|
||||
if attached a_item.date as dt then
|
||||
append_content_tag_to ("pubDate", Void, date_to_string (dt), buffer)
|
||||
end
|
||||
across
|
||||
a_item.links as tb
|
||||
loop
|
||||
tb.item.accept (Current)
|
||||
end
|
||||
if attached a_item.author as u then
|
||||
u.accept (Current)
|
||||
end
|
||||
if attached a_item.categories as cats then
|
||||
across
|
||||
cats as ic
|
||||
loop
|
||||
append_content_tag_to ("category", Void, ic.item, buffer)
|
||||
end
|
||||
end
|
||||
append_content_tag_to ("guid", Void, a_item.id, buffer)
|
||||
append_content_tag_to ("description", Void, a_item.description, buffer)
|
||||
append_cdata_content_tag_to ("content:encoded", Void, a_item.content, buffer)
|
||||
|
||||
exdent
|
||||
buffer.append (indentation)
|
||||
buffer.append ("</item>%N")
|
||||
end
|
||||
|
||||
visit_link (a_link: FEED_LINK)
|
||||
local
|
||||
attr: detachable ARRAYED_LIST [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_32]]
|
||||
tu: TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_32]
|
||||
do
|
||||
create attr.make (2)
|
||||
if attached a_link.relation as rel and then not rel.is_whitespace then
|
||||
tu := ["rel", rel]
|
||||
attr.force (tu)
|
||||
end
|
||||
if attached a_link.type as t and then not t.is_whitespace then
|
||||
tu := ["type", t.as_string_32]
|
||||
attr.force (tu)
|
||||
end
|
||||
if attr.is_empty then
|
||||
attr := Void
|
||||
end
|
||||
append_content_tag_to ("link", attr, a_link.href, buffer)
|
||||
end
|
||||
|
||||
visit_author (a_author: FEED_AUTHOR)
|
||||
do
|
||||
append_content_tag_to ("dc:creator", Void, a_author.name, buffer)
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
date_to_string (dt: DATE_TIME): STRING
|
||||
local
|
||||
htdate: HTTP_DATE
|
||||
do
|
||||
create htdate.make_from_date_time (dt)
|
||||
Result := htdate.rfc850_string
|
||||
end
|
||||
|
||||
end
|
||||
125
library/text/parser/feed/src/rss/rss_2_feed_parser.e
Normal file
125
library/text/parser/feed/src/rss/rss_2_feed_parser.e
Normal file
@@ -0,0 +1,125 @@
|
||||
note
|
||||
description: "[
|
||||
RSS 2.0 Parser.
|
||||
|
||||
Warning: the implementation may not support the full RSS 2.0 specification.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
EIS: "name=RSS at wikipedia", "protocol=URI", "src=https://en.wikipedia.org/wiki/RSS"
|
||||
EIS: "name=RDF Site Summary (RSS) 1.0", "protocol=URI", "src=http://purl.org/rss/1.0/spec"
|
||||
|
||||
class
|
||||
RSS_2_FEED_PARSER
|
||||
|
||||
inherit
|
||||
FEED_PARSER
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING = "rss2"
|
||||
-- Associated name.
|
||||
|
||||
is_detected (xdoc: XML_DOCUMENT): BOOLEAN
|
||||
-- Is `xdoc' an ATOM feed representation?
|
||||
do
|
||||
if attached {XML_ELEMENT} xdoc.element_by_name ("rss") as x_rss then
|
||||
if attached xml_attribute_text (x_rss, "version") as l_version and then
|
||||
l_version.starts_with ("2.")
|
||||
then
|
||||
Result := True
|
||||
else
|
||||
-- Let's default to RSS 2.0 for now.
|
||||
Result := True
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feed (xdoc: XML_DOCUMENT): detachable FEED
|
||||
-- Feed from `xdoc' XML RSS 2.0 document.
|
||||
local
|
||||
lnk: FEED_LINK
|
||||
x_item, x_content, x_author: detachable XML_ELEMENT
|
||||
e: FEED_ITEM
|
||||
l_author: FEED_AUTHOR
|
||||
do
|
||||
if attached xdoc.element_by_name ("rss") as x_rss then
|
||||
if
|
||||
attached xml_attribute_text (x_rss, "version") as l_version and then
|
||||
l_version.starts_with ("2.")
|
||||
then
|
||||
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"), "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
|
||||
l_links as link_ic
|
||||
loop
|
||||
lnk := link_ic.item
|
||||
Result.links.force (lnk, lnk.relation)
|
||||
end
|
||||
end
|
||||
if attached x_channel.elements_by_name ("item") as x_items then
|
||||
across
|
||||
x_items as ic
|
||||
loop
|
||||
x_item := ic.item
|
||||
if attached xml_element_text (x_item, "title") as e_title then
|
||||
create e.make (e_title)
|
||||
e.set_description (xml_element_text (x_item, "description"))
|
||||
e.set_updated_date_with_text (xml_element_text (x_item, "pubDate"))
|
||||
|
||||
e.set_id (xml_element_text (x_item, "guid"))
|
||||
|
||||
x_author := x_item.element_by_name ("creator")
|
||||
if x_author = Void then
|
||||
x_author := element_by_prefixed_name (x_item, "dc" , "creator")
|
||||
end
|
||||
|
||||
if
|
||||
x_author /= Void and then
|
||||
attached x_author.text as l_author_name
|
||||
then
|
||||
create l_author.make (l_author_name)
|
||||
e.set_author (l_author)
|
||||
end
|
||||
|
||||
if attached links_from_xml (x_item, "link") as l_links then
|
||||
across
|
||||
l_links as link_ic
|
||||
loop
|
||||
lnk := link_ic.item
|
||||
e.links.force (lnk, lnk.relation)
|
||||
end
|
||||
end
|
||||
if attached x_item.elements_by_name ("category") as x_categories then
|
||||
across
|
||||
x_categories as cats
|
||||
loop
|
||||
if attached cats.item.text as cat then
|
||||
e.set_category (cat)
|
||||
end
|
||||
end
|
||||
end
|
||||
x_content := x_item.element_by_name ("content")
|
||||
if x_content = Void then
|
||||
x_content := element_by_prefixed_name (x_item, "content" , "encoded")
|
||||
if x_content /= Void then
|
||||
e.set_content (x_content.text, Void)
|
||||
end
|
||||
else
|
||||
e.set_content (xml_element_code (x_content), Void)
|
||||
end
|
||||
Result.extend (e)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
119
library/text/parser/feed/src/support/feed_generator.e
Normal file
119
library/text/parser/feed/src/support/feed_generator.e
Normal file
@@ -0,0 +1,119 @@
|
||||
note
|
||||
description: "Common ancestor for feed generator."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
FEED_GENERATOR
|
||||
|
||||
inherit
|
||||
XML_UTILITIES
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
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")
|
||||
end
|
||||
|
||||
exdent
|
||||
require
|
||||
has_indentation: indentation.count > 0
|
||||
do
|
||||
indentation.remove_tail (1)
|
||||
end
|
||||
|
||||
indentation: STRING
|
||||
|
||||
append_content_tag_to (a_tagname: READABLE_STRING_8; a_attr: detachable ITERABLE [TUPLE [name: READABLE_STRING_8; value: detachable READABLE_STRING_GENERAL]]; a_content: detachable READABLE_STRING_GENERAL; a_output: STRING)
|
||||
do
|
||||
if a_content /= Void or a_attr /= Void then
|
||||
a_output.append (indentation)
|
||||
a_output.append ("<")
|
||||
a_output.append (a_tagname)
|
||||
if a_attr /= Void then
|
||||
across
|
||||
a_attr as ic
|
||||
loop
|
||||
if attached ic.item.value as l_att_value then
|
||||
a_output.append_character (' ')
|
||||
a_output.append (ic.item.name)
|
||||
a_output.append_character ('=')
|
||||
a_output.append_character ('%"')
|
||||
a_output.append (escaped_unicode_xml (l_att_value.as_string_32))
|
||||
a_output.append_character ('%"')
|
||||
end
|
||||
end
|
||||
end
|
||||
if a_content = Void then
|
||||
a_output.append ("/>")
|
||||
else
|
||||
a_output.append (">")
|
||||
a_output.append (escaped_unicode_xml (a_content.as_string_32))
|
||||
a_output.append ("</" + a_tagname + ">%N")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
append_cdata_content_tag_to (a_tagname: READABLE_STRING_8; a_attr: detachable ITERABLE [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_32]]; a_content: detachable READABLE_STRING_32; a_output: STRING)
|
||||
do
|
||||
if a_content /= Void then
|
||||
a_output.append (indentation)
|
||||
a_output.append ("<")
|
||||
a_output.append (a_tagname)
|
||||
if a_attr /= Void then
|
||||
across
|
||||
a_attr as ic
|
||||
loop
|
||||
a_output.append_character (' ')
|
||||
a_output.append (ic.item.name)
|
||||
a_output.append_character ('=')
|
||||
a_output.append_character ('%"')
|
||||
a_output.append (escaped_unicode_xml (ic.item.value))
|
||||
a_output.append_character ('%"')
|
||||
end
|
||||
end
|
||||
a_output.append (">")
|
||||
a_output.append (to_cdata_element (a_content))
|
||||
a_output.append ("</" + a_tagname + ">%N")
|
||||
end
|
||||
end
|
||||
|
||||
to_cdata_element (a_value: READABLE_STRING_GENERAL): STRING
|
||||
local
|
||||
cdata: XML_CHARACTER_DATA
|
||||
xdoc: XML_DOCUMENT
|
||||
pprinter: XML_NODE_PRINTER
|
||||
l_output: XML_STRING_8_OUTPUT_STREAM
|
||||
do
|
||||
create xdoc.make
|
||||
create cdata.make (xdoc.root_element, a_value.as_string_32)
|
||||
create pprinter.make
|
||||
create Result.make (cdata.content_count)
|
||||
create l_output.make (Result)
|
||||
pprinter.set_output (l_output)
|
||||
pprinter.process_character_data (cdata)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
86
library/text/parser/feed/src/support/feed_helpers.e
Normal file
86
library/text/parser/feed/src/support/feed_helpers.e
Normal file
@@ -0,0 +1,86 @@
|
||||
note
|
||||
description: "Helpers routine for feed library."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_HELPERS
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
date_time (a_date_string: READABLE_STRING_32): DATE_TIME
|
||||
-- "2015-08-14T10:34:13.493740Z"
|
||||
-- "Sat, 07 Sep 2002 00:00:01 GMT"
|
||||
local
|
||||
i,j: INTEGER
|
||||
s: READABLE_STRING_GENERAL
|
||||
y,m,d,h,min: INTEGER
|
||||
sec: REAL_64
|
||||
htdate: HTTP_DATE
|
||||
str: STRING_32
|
||||
do
|
||||
if a_date_string.count > 0 and then a_date_string.item (1).is_digit then
|
||||
i := a_date_string.index_of ('-', 1)
|
||||
if i > 0 then
|
||||
s := a_date_string.substring (1, i - 1)
|
||||
y := s.to_integer_32 -- Year
|
||||
j := i + 1
|
||||
i := a_date_string.index_of ('-', j)
|
||||
if i > 0 then
|
||||
s := a_date_string.substring (j, i - 1)
|
||||
m := s.to_integer_32 -- Month
|
||||
j := i + 1
|
||||
i := a_date_string.index_of ('T', j)
|
||||
if i = 0 then
|
||||
i := a_date_string.index_of (' ', j)
|
||||
end
|
||||
if i = 0 then
|
||||
i := a_date_string.count + 1
|
||||
end
|
||||
if i > 0 then
|
||||
s := a_date_string.substring (j, i - 1)
|
||||
if s.is_integer then
|
||||
d := s.to_integer_32 -- Day
|
||||
j := i + 1
|
||||
i := a_date_string.index_of (':', j)
|
||||
if i > 0 then
|
||||
s := a_date_string.substring (j, i - 1)
|
||||
h := s.to_integer
|
||||
j := i + 1
|
||||
i := a_date_string.index_of (':', j)
|
||||
if i > 0 then
|
||||
s := a_date_string.substring (j, i - 1)
|
||||
min := s.to_integer
|
||||
j := i + 1
|
||||
i := a_date_string.index_of ('Z', j)
|
||||
if i = 0 then
|
||||
i := a_date_string.count + 1
|
||||
end
|
||||
s := a_date_string.substring (j, i - 1)
|
||||
sec := s.to_double
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
create Result.make (y,m,d,h,m,0)
|
||||
Result.fine_second_add (sec)
|
||||
else
|
||||
i := a_date_string.index_of ('+', 1)
|
||||
if i > 0 then
|
||||
str := a_date_string.substring (1, i - 1)
|
||||
str.append (" GMT")
|
||||
create htdate.make_from_string (str)
|
||||
Result := htdate.date_time
|
||||
if a_date_string.substring (i + 1, a_date_string.count).is_case_insensitive_equal ("0000") then
|
||||
|
||||
end
|
||||
else
|
||||
create htdate.make_from_string (a_date_string)
|
||||
Result := htdate.date_time
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
83
library/text/parser/feed/src/support/feed_parser_utilities.e
Normal file
83
library/text/parser/feed/src/support/feed_parser_utilities.e
Normal file
@@ -0,0 +1,83 @@
|
||||
note
|
||||
description: "Helpers routine for feed xml parsers."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
FEED_PARSER_UTILITIES
|
||||
|
||||
feature -- Access
|
||||
|
||||
xml_element_text (a_parent: XML_ELEMENT; a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
do
|
||||
if attached a_parent.element_by_name (a_name) as elt then
|
||||
if attached elt.text as t then
|
||||
t.left_adjust
|
||||
t.right_adjust
|
||||
Result := t
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
xml_attribute_text (a_elt: XML_ELEMENT; a_att_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
do
|
||||
if attached a_elt.attribute_by_name (a_att_name) as att then
|
||||
Result := att.value
|
||||
end
|
||||
end
|
||||
|
||||
xml_element_code (elt: XML_ELEMENT): STRING_32
|
||||
local
|
||||
xprinter: XML_NODE_PRINTER
|
||||
do
|
||||
create xprinter.make
|
||||
create Result.make_empty
|
||||
xprinter.set_output (create {XML_STRING_32_OUTPUT_STREAM}.make (Result))
|
||||
xprinter.process_element (elt)
|
||||
end
|
||||
|
||||
links_from_xml (elt: XML_ELEMENT; a_link_elt_name: READABLE_STRING_GENERAL): detachable ARRAYED_LIST [FEED_LINK]
|
||||
local
|
||||
x_link: XML_ELEMENT
|
||||
lnk: FEED_LINK
|
||||
do
|
||||
if attached elt.elements_by_name (a_link_elt_name) as x_links then
|
||||
create Result.make (0)
|
||||
across
|
||||
x_links as ic
|
||||
loop
|
||||
x_link := ic.item
|
||||
if attached xml_attribute_text (x_link, "href") as l_href and then
|
||||
l_href.is_valid_as_string_8
|
||||
then
|
||||
create lnk.make (l_href.as_string_8)
|
||||
lnk.set_relation (xml_attribute_text (x_link, "rel"))
|
||||
lnk.set_type (xml_attribute_text (x_link, "type"))
|
||||
Result.force (lnk)
|
||||
elseif attached x_link.text as l_url and then not l_url.is_whitespace then
|
||||
create lnk.make (l_url)
|
||||
Result.force (lnk)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
element_by_prefixed_name (elt: XML_ELEMENT; a_ns_prefix: READABLE_STRING_GENERAL; a_name: READABLE_STRING_GENERAL): detachable XML_ELEMENT
|
||||
do
|
||||
across
|
||||
elt as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
if attached {XML_ELEMENT} ic.item as x_item then
|
||||
if
|
||||
attached x_item.ns_prefix as l_ns_prefix and then a_ns_prefix.same_string (l_ns_prefix) and then
|
||||
a_name.same_string (x_item.name)
|
||||
then
|
||||
Result := x_item
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,200 @@
|
||||
note
|
||||
description: "[
|
||||
Convert a FEED to STRING_32 representation.
|
||||
Mostly for debug output!
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_TO_STRING_32_DEBUG_VISITOR
|
||||
|
||||
inherit
|
||||
FEED_VISITOR
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_buffer: STRING_32)
|
||||
do
|
||||
buffer := a_buffer
|
||||
create indentation.make_empty
|
||||
end
|
||||
|
||||
buffer: STRING_32
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
do
|
||||
if attached a_feed.id as l_id then
|
||||
append_text ("#")
|
||||
append (l_id)
|
||||
append_new_line
|
||||
end
|
||||
if attached a_feed.date as dt then
|
||||
append_text ("date:")
|
||||
append (dt.out)
|
||||
append_new_line
|
||||
end
|
||||
|
||||
append_text (a_feed.title)
|
||||
append_new_line
|
||||
indent
|
||||
if attached a_feed.description as l_desc then
|
||||
append_text (l_desc)
|
||||
append_new_line
|
||||
end
|
||||
|
||||
across
|
||||
a_feed.links as ic
|
||||
loop
|
||||
ic.item.accept (Current)
|
||||
append_new_line
|
||||
end
|
||||
|
||||
append_new_line
|
||||
|
||||
across
|
||||
a_feed.items as ic
|
||||
loop
|
||||
exdent
|
||||
append_text (create {STRING_32}.make_filled ('-', 40))
|
||||
append_new_line
|
||||
indent
|
||||
ic.item.accept (Current)
|
||||
append_new_line
|
||||
end
|
||||
end
|
||||
|
||||
visit_item (a_entry: FEED_ITEM)
|
||||
do
|
||||
if attached a_entry.id as l_id then
|
||||
append_text ("#")
|
||||
append (l_id)
|
||||
append_new_line
|
||||
end
|
||||
if attached a_entry.date as dt then
|
||||
append_text ("date:")
|
||||
append (dt.out)
|
||||
append_new_line
|
||||
end
|
||||
append_text (a_entry.title)
|
||||
append_new_line
|
||||
indent
|
||||
if attached a_entry.author as l_author then
|
||||
l_author.accept (Current)
|
||||
append_new_line
|
||||
end
|
||||
if attached a_entry.categories as cats then
|
||||
append_text ("Categories: ")
|
||||
from
|
||||
cats.start
|
||||
until
|
||||
cats.after
|
||||
loop
|
||||
if not cats.isfirst then
|
||||
append (", ")
|
||||
end
|
||||
append (cats.item)
|
||||
cats.forth
|
||||
end
|
||||
append_new_line
|
||||
end
|
||||
if attached a_entry.description as l_summary then
|
||||
append_text (l_summary)
|
||||
append_new_line
|
||||
end
|
||||
|
||||
across
|
||||
a_entry.links as ic
|
||||
loop
|
||||
ic.item.accept (Current)
|
||||
append_new_line
|
||||
end
|
||||
|
||||
if attached a_entry.content as l_content then
|
||||
append_text (l_content)
|
||||
append_new_line
|
||||
end
|
||||
exdent
|
||||
end
|
||||
|
||||
visit_link (a_link: FEED_LINK)
|
||||
local
|
||||
s: STRING_32
|
||||
do
|
||||
create s.make_empty
|
||||
s.append_string_general ("@")
|
||||
s.append_string (a_link.relation)
|
||||
s.append_string (" -> ")
|
||||
s.append_string (a_link.href)
|
||||
append_text (s)
|
||||
end
|
||||
|
||||
visit_author (a_author: FEED_AUTHOR)
|
||||
local
|
||||
s: STRING_32
|
||||
do
|
||||
create s.make_empty
|
||||
s.append_string_general ("by ")
|
||||
s.append_string (a_author.name)
|
||||
if attached a_author.email as l_email then
|
||||
s.append_character (' ')
|
||||
s.append_character ('(')
|
||||
s.append_string_general (l_email)
|
||||
s.append_character (')')
|
||||
end
|
||||
append_text (s)
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
indentation: STRING_32
|
||||
|
||||
indent
|
||||
do
|
||||
indentation.append (" ")
|
||||
end
|
||||
|
||||
exdent
|
||||
do
|
||||
indentation.remove_tail (2)
|
||||
end
|
||||
|
||||
append_new_line
|
||||
do
|
||||
append ("%N")
|
||||
end
|
||||
|
||||
append_text (s: READABLE_STRING_GENERAL)
|
||||
local
|
||||
lst: LIST [READABLE_STRING_GENERAL]
|
||||
do
|
||||
if indentation.is_empty then
|
||||
append (s)
|
||||
else
|
||||
lst := s.split ('%N')
|
||||
from
|
||||
lst.start
|
||||
until
|
||||
lst.after
|
||||
loop
|
||||
append (indentation)
|
||||
append (lst.item)
|
||||
if not lst.islast then
|
||||
append ("%N")
|
||||
end
|
||||
lst.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
append (s: READABLE_STRING_GENERAL)
|
||||
do
|
||||
buffer.append_string_general (s)
|
||||
end
|
||||
|
||||
end
|
||||
229
library/text/parser/feed/src/support/feed_to_xhtml_visitor.e
Normal file
229
library/text/parser/feed/src/support/feed_to_xhtml_visitor.e
Normal file
@@ -0,0 +1,229 @@
|
||||
note
|
||||
description: "[
|
||||
Convert a FEED to XHTML representation.
|
||||
]"
|
||||
date: "$Date: 2015-10-08 10:45:13 +0200 (jeu., 08 oct. 2015) $"
|
||||
revision: "$Revision: 97964 $"
|
||||
|
||||
class
|
||||
FEED_TO_XHTML_VISITOR
|
||||
|
||||
inherit
|
||||
FEED_VISITOR
|
||||
|
||||
SHARED_HTML_ENCODER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_buffer: STRING_8)
|
||||
do
|
||||
buffer := a_buffer
|
||||
create today.make_now_utc
|
||||
description_enabled := False
|
||||
limit := -1
|
||||
end
|
||||
|
||||
buffer: STRING_8
|
||||
-- Output buffer.
|
||||
|
||||
today: DATE_TIME
|
||||
-- Current date.
|
||||
|
||||
feature -- Access
|
||||
|
||||
header: detachable READABLE_STRING_8
|
||||
-- Optional header.
|
||||
|
||||
footer: detachable READABLE_STRING_8
|
||||
-- Optional footer.
|
||||
|
||||
feature -- Settings
|
||||
|
||||
limit: INTEGER
|
||||
-- Number of item to include in XHTML generation.
|
||||
-- Default: -1 => No limit
|
||||
|
||||
description_enabled: BOOLEAN
|
||||
-- Generate description?
|
||||
-- Default: False
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_limit (nb: INTEGER)
|
||||
-- Set `limit' to `nb'.
|
||||
do
|
||||
limit := nb
|
||||
end
|
||||
|
||||
set_description_enabled (b: BOOLEAN)
|
||||
-- Set `description_enabled' to `b'.
|
||||
do
|
||||
description_enabled := b
|
||||
end
|
||||
|
||||
set_header (h: like header)
|
||||
do
|
||||
header := h
|
||||
end
|
||||
|
||||
set_footer (f: like footer)
|
||||
do
|
||||
footer := f
|
||||
end
|
||||
|
||||
feature -- Visitor
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
local
|
||||
nb: INTEGER
|
||||
do
|
||||
append ("<div class=%"feed%">")
|
||||
if attached header as h then
|
||||
append (h)
|
||||
append ("%N")
|
||||
end
|
||||
if attached a_feed.date as dt then
|
||||
append ("<!-- date:")
|
||||
append (dt.out)
|
||||
append (" -->%N")
|
||||
end
|
||||
|
||||
append ("<ul>%N")
|
||||
if
|
||||
description_enabled and then
|
||||
attached a_feed.description as l_desc and then
|
||||
l_desc.is_valid_as_string_8
|
||||
then
|
||||
append ("<div class=%"description%">")
|
||||
append (l_desc.to_string_8)
|
||||
append ("</div>")
|
||||
end
|
||||
|
||||
nb := limit
|
||||
across
|
||||
a_feed as ic
|
||||
until
|
||||
nb = 0
|
||||
loop
|
||||
ic.item.accept (Current)
|
||||
nb := nb - 1
|
||||
end
|
||||
|
||||
if attached footer as f then
|
||||
append (f)
|
||||
append ("%N")
|
||||
end
|
||||
append ("</ul>%N")
|
||||
end
|
||||
|
||||
visit_item (a_entry: FEED_ITEM)
|
||||
local
|
||||
lnk: detachable FEED_LINK
|
||||
do
|
||||
append ("<li>%N")
|
||||
lnk := a_entry.link
|
||||
|
||||
if attached a_entry.date as dt then
|
||||
append ("<div class=%"date%">")
|
||||
append_date_time_to (dt, today.date, buffer)
|
||||
append ("</div>%N")
|
||||
end
|
||||
if lnk /= Void then
|
||||
append ("<a href=%"" + lnk.href + "%">")
|
||||
else
|
||||
check has_link: False end
|
||||
append ("<a href=%"#%">")
|
||||
end
|
||||
append_as_html_encoded (a_entry.title)
|
||||
append ("</a>%N")
|
||||
debug
|
||||
if attached a_entry.categories as l_categories and then not l_categories.is_empty then
|
||||
append ("<div class=%"category%">")
|
||||
across
|
||||
l_categories as cats_ic
|
||||
loop
|
||||
append_as_html_encoded (cats_ic.item)
|
||||
append (" ")
|
||||
end
|
||||
append ("</div>%N")
|
||||
end
|
||||
end
|
||||
if
|
||||
description_enabled and then
|
||||
attached a_entry.description as l_entry_desc
|
||||
then
|
||||
if l_entry_desc.is_valid_as_string_8 then
|
||||
append ("<div class=%"description%">")
|
||||
append (l_entry_desc.as_string_8)
|
||||
append ("</div>%N")
|
||||
else
|
||||
check is_html: False end
|
||||
end
|
||||
end
|
||||
append ("</li>%N")
|
||||
end
|
||||
|
||||
visit_link (a_link: FEED_LINK)
|
||||
do
|
||||
append ("<a href=%"" + a_link.href + "%">")
|
||||
append_as_html_encoded (a_link.relation)
|
||||
append ("</a>%N")
|
||||
end
|
||||
|
||||
visit_author (a_author: FEED_AUTHOR)
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
append_as_html_encoded (s: READABLE_STRING_GENERAL)
|
||||
do
|
||||
buffer.append (html_encoder.general_encoded_string (s))
|
||||
end
|
||||
|
||||
append (s: READABLE_STRING_8)
|
||||
do
|
||||
buffer.append (s)
|
||||
end
|
||||
|
||||
append_date_time_to (dt: DATE_TIME; a_today: DATE; a_output: STRING_GENERAL)
|
||||
do
|
||||
if dt.year /= a_today.year then
|
||||
a_output.append (dt.year.out)
|
||||
a_output.append (",")
|
||||
end
|
||||
a_output.append (" ")
|
||||
append_month_mmm_to (dt.month, a_output)
|
||||
a_output.append (" ")
|
||||
if dt.day < 10 then
|
||||
a_output.append ("0")
|
||||
end
|
||||
a_output.append (dt.day.out)
|
||||
end
|
||||
|
||||
append_month_mmm_to (m: INTEGER; s: STRING_GENERAL)
|
||||
require
|
||||
1 <= m and m <= 12
|
||||
do
|
||||
inspect m
|
||||
when 1 then s.append ("Jan")
|
||||
when 2 then s.append ("Feb")
|
||||
when 3 then s.append ("Mar")
|
||||
when 4 then s.append ("Apr")
|
||||
when 5 then s.append ("May")
|
||||
when 6 then s.append ("Jun")
|
||||
when 7 then s.append ("Jul")
|
||||
when 8 then s.append ("Aug")
|
||||
when 9 then s.append ("Sep")
|
||||
when 10 then s.append ("Oct")
|
||||
when 11 then s.append ("Nov")
|
||||
when 12 then s.append ("Dec")
|
||||
else
|
||||
-- Error
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
27
library/text/parser/feed/src/support/feed_visitor.e
Normal file
27
library/text/parser/feed/src/support/feed_visitor.e
Normal file
@@ -0,0 +1,27 @@
|
||||
note
|
||||
description: "Interface to visit Feed objects."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
FEED_VISITOR
|
||||
|
||||
feature -- Visit
|
||||
|
||||
visit_feed (a_feed: FEED)
|
||||
deferred
|
||||
end
|
||||
|
||||
visit_link (a_link: FEED_LINK)
|
||||
deferred
|
||||
end
|
||||
|
||||
visit_item (a_item: FEED_ITEM)
|
||||
deferred
|
||||
end
|
||||
|
||||
visit_author (a_author: FEED_AUTHOR)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
91
library/text/parser/feed/tests/application.e
Normal file
91
library/text/parser/feed/tests/application.e
Normal file
@@ -0,0 +1,91 @@
|
||||
note
|
||||
description: "Summary description for {APPLICATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make
|
||||
-- New test routine
|
||||
do
|
||||
test_file ("data_rss_1_0.rss")
|
||||
test_web ("https://bertrandmeyer.com/feed/")
|
||||
end
|
||||
|
||||
test_file (fn: READABLE_STRING_GENERAL)
|
||||
local
|
||||
t: STRING
|
||||
f: PLAIN_TEXT_FILE
|
||||
do
|
||||
create f.make_with_name (fn)
|
||||
f.open_read
|
||||
create t.make_empty
|
||||
from
|
||||
f.read_stream_thread_aware (1_024)
|
||||
until
|
||||
f.last_string.count < 1024
|
||||
loop
|
||||
t.append (f.last_string)
|
||||
f.read_stream_thread_aware (1_024)
|
||||
end
|
||||
t.append (f.last_string)
|
||||
f.close
|
||||
test_feed (t)
|
||||
end
|
||||
|
||||
test_feed (t: READABLE_STRING_8)
|
||||
local
|
||||
feed_parser: FEED_DEFAULT_PARSERS
|
||||
vis: FEED_TO_STRING_32_DEBUG_VISITOR
|
||||
gen: RSS_2_FEED_GENERATOR
|
||||
atom_gen: ATOM_FEED_GENERATOR
|
||||
s: STRING_32
|
||||
s8: STRING_8
|
||||
pp: XML_PRETTY_PRINT_FILTER
|
||||
do
|
||||
create feed_parser
|
||||
if attached feed_parser.feed_from_string (t) as l_feed then
|
||||
create s.make_empty
|
||||
create vis.make (s)
|
||||
l_feed.accept (vis)
|
||||
print (s)
|
||||
|
||||
create s8.make_empty
|
||||
create gen.make (s8)
|
||||
l_feed.accept (gen)
|
||||
print (s8)
|
||||
|
||||
create s8.make_empty
|
||||
create atom_gen.make (s8)
|
||||
l_feed.accept (atom_gen)
|
||||
print (s8)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
test_web (a_url: READABLE_STRING_8)
|
||||
local
|
||||
cl: LIBCURL_HTTP_CLIENT
|
||||
sess: HTTP_CLIENT_SESSION
|
||||
do
|
||||
create cl.make
|
||||
sess := cl.new_session (a_url)
|
||||
sess.set_is_insecure (True)
|
||||
if attached sess.get ("", Void) as resp then
|
||||
if
|
||||
not resp.error_occurred and then
|
||||
attached resp.body as l_feed
|
||||
then
|
||||
test_feed (l_feed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
74
library/text/parser/feed/tests/atom_test_set.e
Normal file
74
library/text/parser/feed/tests/atom_test_set.e
Normal file
@@ -0,0 +1,74 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
ATOM_TEST_SET
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_atom
|
||||
-- New test routine
|
||||
local
|
||||
feed_parser: FEED_DEFAULT_PARSERS
|
||||
vis: FEED_TO_STRING_32_DEBUG_VISITOR
|
||||
s: STRING_32
|
||||
do
|
||||
create feed_parser
|
||||
if attached feed_parser.feed_from_string (atom_string_1) as l_feed then
|
||||
create s.make_empty
|
||||
create vis.make (s)
|
||||
l_feed.accept (vis)
|
||||
print (s)
|
||||
assert ("not_implemented", False)
|
||||
end
|
||||
assert ("not_implemented", False)
|
||||
end
|
||||
|
||||
feature {NONE} -- Data
|
||||
|
||||
atom_string_1: STRING = "[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title>Example Feed</title>
|
||||
<subtitle>A subtitle.</subtitle>
|
||||
<link href="http://example.org/feed/" rel="self" />
|
||||
<link href="http://example.org/" />
|
||||
<id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
|
||||
<updated>2003-12-13T18:30:02Z</updated>
|
||||
|
||||
|
||||
<entry>
|
||||
<title>Atom-Powered Robots Run Amok</title>
|
||||
<link href="http://example.org/2003/12/13/atom03" />
|
||||
<link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/>
|
||||
<link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/>
|
||||
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
|
||||
<updated>2003-12-13T18:30:02Z</updated>
|
||||
<summary>Some text.</summary>
|
||||
<content type="xhtml">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml">
|
||||
<p>This is the entry content.</p>
|
||||
</div>
|
||||
</content>
|
||||
<author>
|
||||
<name>John Doe</name>
|
||||
<email>johndoe@example.com</email>
|
||||
</author>
|
||||
</entry>
|
||||
|
||||
</feed>
|
||||
]"
|
||||
end
|
||||
|
||||
|
||||
60
library/text/parser/feed/tests/rss_test_set.e
Normal file
60
library/text/parser/feed/tests/rss_test_set.e
Normal file
@@ -0,0 +1,60 @@
|
||||
note
|
||||
description: "Summary description for {RSS_TEST_SET}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
RSS_TEST_SET
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
test_rss_2
|
||||
-- New test routine
|
||||
local
|
||||
feed_parser: FEED_DEFAULT_PARSERS
|
||||
vis: FEED_TO_STRING_32_DEBUG_VISITOR
|
||||
s: STRING_32
|
||||
do
|
||||
create feed_parser
|
||||
if attached feed_parser.feed_from_string (rss_2_string_1) as l_feed then
|
||||
create s.make_empty
|
||||
create vis.make (s)
|
||||
l_feed.accept (vis)
|
||||
print (s)
|
||||
assert ("not_implemented", False)
|
||||
end
|
||||
assert ("not_implemented", False)
|
||||
end
|
||||
|
||||
feature {NONE} -- Data
|
||||
|
||||
rss_2_string_1: STRING = "[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>Mon site</title>
|
||||
<description>Ceci est un exemple de flux RSS 2.0</description>
|
||||
<lastBuildDate>Sat, 07 Sep 2002 00:00:01 GMT</lastBuildDate>
|
||||
<link>http://www.example.org</link>
|
||||
<item>
|
||||
<title>Post N1</title>
|
||||
<description>This is my first post</description>
|
||||
<pubDate>Sat, 07 Sep 2002 00:00:01 GMT</pubDate>
|
||||
<link>http://www.example.org/actu1</link>
|
||||
</item>
|
||||
<item>
|
||||
<title>Post N2</title>
|
||||
<description>This is my second post</description>
|
||||
<pubDate>Sat, 07 Sep 2002 00:00:01 GMT</pubDate>
|
||||
<link>http://www.example.org/actu2</link>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
]"
|
||||
end
|
||||
|
||||
|
||||
14
library/text/parser/feed/tests/tests-safe.ecf
Normal file
14
library/text/parser/feed/tests/tests-safe.ecf
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="tests" uuid="C68BD5DC-F756-484E-A9FE-F2D1FD432B2A">
|
||||
<target name="tests">
|
||||
<root class="APPLICATION" feature="make"/>
|
||||
<setting name="console_application" value="false"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="feed" location="..\feed-safe.ecf" readonly="false"/>
|
||||
<library name="http_client" location="$ISE_LIBRARY\contrib\library\network\http_client\http_client-safe.ecf"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
<library name="xml_parser" location="$ISE_LIBRARY\library\text\parser\xml\parser\xml_parser-safe.ecf"/>
|
||||
<tests name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
12
library/text/parser/feed/tests/tests.ecf
Normal file
12
library/text/parser/feed/tests/tests.ecf
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="tests" uuid="C68BD5DC-F756-484E-A9FE-F2D1FD432B2A">
|
||||
<target name="tests">
|
||||
<root class="ANY" feature="default_create"/>
|
||||
<setting name="console_application" value="false"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="feed" location="..\feed.ecf"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing.ecf"/>
|
||||
<tests name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -2,8 +2,8 @@ note
|
||||
description : "Objects that represent a custom error"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
date: "$Date: 2015-10-10 00:55:41 +0200 (sam., 10 oct. 2015) $"
|
||||
revision: "$Revision: 97980 $"
|
||||
|
||||
class
|
||||
ERROR_CUSTOM
|
||||
@@ -24,7 +24,7 @@ feature {NONE} -- Initialization
|
||||
if a_message /= Void then
|
||||
message := a_message
|
||||
else
|
||||
message := "Error: " + a_name + " (code=" + a_code.out + ")"
|
||||
message := {STRING_32} "Error: " + a_name + " (code=" + a_code.out + ")"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ note
|
||||
description : "Objects that handle error..."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
date: "$Date: 2015-10-10 00:55:41 +0200 (sam., 10 oct. 2015) $"
|
||||
revision: "$Revision: 97980 $"
|
||||
|
||||
class
|
||||
ERROR_HANDLER
|
||||
@@ -216,7 +216,7 @@ feature -- Basic operation
|
||||
on_error_added (a_error)
|
||||
end
|
||||
|
||||
add_error_details, add_custom_error (a_code: INTEGER; a_name: STRING; a_message: detachable STRING_32)
|
||||
add_error_details, add_custom_error (a_code: INTEGER; a_name: STRING; a_message: detachable READABLE_STRING_32)
|
||||
-- Add custom error to the stack of error
|
||||
local
|
||||
e: ERROR_CUSTOM
|
||||
|
||||
@@ -64,4 +64,9 @@
|
||||
<root all_classes="true"/>
|
||||
<setting name="platform" value="unix"/>
|
||||
</target>
|
||||
<target name="all_stable_with_ssl" extends="all_stable">
|
||||
<description>Compiling with ssl enabled</description>
|
||||
<root all_classes="true"/>
|
||||
<variable name="httpd_ssl_enabled" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -89,15 +89,17 @@ echo Install library: http
|
||||
echo Install library: content_negotiation
|
||||
%COPYCMD% %TMP_DIR%\library\network\protocol\content_negotiation %TMP_CONTRIB_DIR%\library\network\protocol\content_negotiation
|
||||
echo Install library: http_authorization
|
||||
%SAFE_MD% %TMP_CONTRIB_DIR%\library\network\authentication
|
||||
%SAFE_MD% %TMP_CONTRIB_DIR%\library\web\authentication
|
||||
%COPYCMD% %TMP_DIR%\library\server\authentication\http_authorization %TMP_CONTRIB_DIR%\library\web\authentication\http_authorization
|
||||
|
||||
echo Install library: openid
|
||||
%SAFE_MD% %TMP_CONTRIB_DIR%\library\security
|
||||
%SAFE_MD% %TMP_CONTRIB_DIR%\library\web\authentication
|
||||
%COPYCMD% %TMP_DIR%\library\security\openid %TMP_CONTRIB_DIR%\library\web\authentication\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
|
||||
|
||||
@@ -60,11 +60,13 @@ echo Uninstall library: http
|
||||
echo Uninstall library: content_negotiation
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\network\protocol\content_negotiation
|
||||
echo Uninstall library: http_authorization
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\network\authentication\http_authorization
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\library\web\authentication\http_authorization
|
||||
echo Uninstall library: security\openid
|
||||
%RDCMD% %TMP_CONTRIB_DIR%\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