Make the atom feed more palatable
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/kosuzu/trunk@63 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
10
cli/atom.ml
10
cli/atom.ml
@@ -11,8 +11,8 @@ let opt_element tag_name content =
|
||||
|
||||
module P = Parsers.Plain_text.Make (Converter.Html)
|
||||
|
||||
let id txt = "<id>urn:txtid:" ^ Logarion.(txt.Text.id) ^ "</id>"
|
||||
let title text = "<title>" ^ esc text.Logarion.Text.title ^ "</title>"
|
||||
let id txt = "<id>urn:txtid:" ^ Logarion.(txt.Text.id) ^ "</id>\n"
|
||||
let title text = "<title>" ^ esc text.Logarion.Text.title ^ "</title>\n"
|
||||
|
||||
let authors text =
|
||||
let u acc addr = acc ^ element "uri" addr in
|
||||
@@ -20,16 +20,16 @@ let authors text =
|
||||
let fn txt a =
|
||||
a ^ "<author>" ^ (opt_element "name" @@ esc txt.Person.name)
|
||||
^ (List.fold_left u "" txt.Person.addresses)
|
||||
^ "</author>" in
|
||||
^ "</author>\n" in
|
||||
Person.Set.fold fn text.Text.authors ""
|
||||
|
||||
let updated txt = let open Logarion in
|
||||
"<updated>"^ Date.(txt.Text.date |> listing |> rfc_string) ^"</updated>"
|
||||
"<updated>"^ Date.(txt.Text.date |> listing |> rfc_string) ^"</updated>\n"
|
||||
|
||||
let htm_entry base_url text =
|
||||
let open Logarion in
|
||||
let u = Text.short_id text in
|
||||
"<entry>\n<link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".htm\" />"
|
||||
"<entry>\n<link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".htm\" />\n"
|
||||
^ title text ^ id text ^ updated text ^ authors text
|
||||
^ (opt_element "summary" @@ esc @@ Text.str "abstract" text)
|
||||
^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ esc elt ^ "\"/>\n") (Text.set "topics" text) ""
|
||||
|
||||
Reference in New Issue
Block a user