Fix RSS/Atom generation for Gemini and HTTP, remove the txt publish feature
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/kosuzu/trunk@61 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
16
cli/atom.ml
16
cli/atom.ml
@@ -11,7 +11,7 @@ let opt_element tag_name content =
|
||||
|
||||
module P = Parsers.Plain_text.Make (Converter.Html)
|
||||
|
||||
let id txt = "<id>urn:uuid:" ^ Logarion.(txt.Text.id) ^ "</id>"
|
||||
let id txt = "<id>urn:txtid:" ^ Logarion.(txt.Text.id) ^ "</id>"
|
||||
let title text = "<title>" ^ esc text.Logarion.Text.title ^ "</title>"
|
||||
|
||||
let authors text =
|
||||
@@ -29,21 +29,19 @@ let updated txt = let open Logarion in
|
||||
let htm_entry base_url text =
|
||||
let open Logarion in
|
||||
let u = Text.short_id text in
|
||||
"<entry><link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".htm\" />"
|
||||
"<entry>\n<link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".htm\" />"
|
||||
^ 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 ^ "\"/>") (Text.set "topics" text) ""
|
||||
^ "<content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">"
|
||||
^ P.of_string text.body ""
|
||||
^ "</div></content></entry>\n"
|
||||
^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ esc elt ^ "\"/>\n") (Text.set "topics" text) ""
|
||||
^ "</entry>\n"
|
||||
|
||||
let gmi_entry base_url text =
|
||||
let open Logarion in
|
||||
let u = Text.short_id text in
|
||||
"<entry><link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".gmi\" />"
|
||||
"<entry>\n<link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".gmi\" />\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=\"" ^ elt ^ "\"/>") (Text.set "topics" text) ""
|
||||
^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ elt ^ "\"/>\n") (Text.set "topics" text) ""
|
||||
^ "</entry>\n"
|
||||
|
||||
let base_url kv protocol = try
|
||||
@@ -65,7 +63,7 @@ let indices alternate_type c =
|
||||
{|<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:base="|} ^ base_url ^ {|"><title>|}
|
||||
^ title ^ {|</title><link rel="alternate" type="|} ^ alternate_type ^ {|" href="|}
|
||||
^ base_url ^ {|/" /><link rel="self" type="application/atom+xml" href="|}
|
||||
^ self ^ {|" /><id>urn:uuid:|} ^ c.Conversion.id ^ "</id><updated>"
|
||||
^ self ^ {|" /><id>urn:txtid:|} ^ c.Conversion.id ^ "</id><updated>"
|
||||
^ Logarion.Date.now () ^ "</updated>\n"
|
||||
^ List.fold_left (fun acc t -> acc ^ entry base_url t) "" c.texts
|
||||
^ "</feed>"
|
||||
|
||||
Reference in New Issue
Block a user