Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rss: generate atom:link for RSS 2.0 if ~self_link given.

  • Loading branch information...
commit f82f747d36f1c62d49223a74c2648373872c3591 1 parent e629bf5
@mfp authored
Showing with 12 additions and 5 deletions.
  1. +9 −2 rss.ml
  2. +3 −3 rss.mli
View
11 rss.ml
@@ -53,7 +53,7 @@ let xml_of_item item =
]])
let make
- ~title ~link ~description
+ ~title ~link ~description ?self_link
?language ?copyright ?managingEditor ?webMaster ?pubDate
?lastBuildDate ?category ?generator ?ttl ?image
items =
@@ -61,6 +61,12 @@ let make
filter_concat
[[some_elm "title" title;
some_elm "link" link;
+ Option.map
+ (fun link ->
+ Leaf ("atom:link", [string_attrib "href" link;
+ string_attrib "rel" "self";
+ string_attrib "type" "application/rss+xml"]))
+ self_link;
some_elm "description" description;
opt_elm "language" language;
@@ -83,7 +89,8 @@ let make
List.map (fun it -> Some (xml_of_item it)) items
]
in
- Node("rss", [string_attrib "version" "2.0"],
+ Node("rss", [string_attrib "version" "2.0";
+ string_attrib "xmlns:atom" "http://www.w3.org/2005/Atom"],
[Node("channel", [], channel)])
let make_rdf
View
6 rss.mli
@@ -4,14 +4,14 @@ type item
val item_date : item -> float option
val make :
- title:string -> link:string -> description:string ->
+ title:string -> link:string -> description:string -> ?self_link:string ->
?language:string -> ?copyright:string -> ?managingEditor:string ->
?webMaster:string -> ?pubDate:float -> ?lastBuildDate:float ->
- ?category:string -> ?generator:string -> ?ttl:int -> ?image:image ->
+ ?category:string -> ?generator:string -> ?ttl:int -> ?image:image ->
item list -> XML.elt
val make_item : title:string -> link:string -> description:string ->
- ?author:string -> ?category:string -> ?comments:string -> ?pubDate:float ->
+ ?author:string -> ?category:string -> ?comments:string -> ?pubDate:float ->
?guid:string * bool -> unit -> item
val make_rdf : title:string -> link:string -> description:string ->
Please sign in to comment.
Something went wrong with that request. Please try again.