Changeset 61 in code for trunk/cli/atom.ml


Ignore:
Timestamp:
Apr 1, 2024, 2:01:11 PM (13 months ago)
Author:
yakumo.izuru
Message:

Fix RSS/Atom generation for Gemini and HTTP, remove the txt publish feature

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/atom.ml

    r26 r61  
    1212module P = Parsers.Plain_text.Make (Converter.Html)
    1313
    14 let id txt = "<id>urn:uuid:" ^ Logarion.(txt.Text.id) ^ "</id>"
     14let id txt = "<id>urn:txtid:" ^ Logarion.(txt.Text.id) ^ "</id>"
    1515let title text = "<title>" ^ esc text.Logarion.Text.title ^ "</title>"
    1616
     
    3030  let open Logarion in
    3131  let u = Text.short_id text in
    32   "<entry><link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".htm\" />"
     32  "<entry>\n<link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".htm\" />"
    3333  ^ title text ^ id text ^ updated text ^ authors text
    3434  ^ (opt_element "summary" @@ esc @@ Text.str "abstract" text)
    35   ^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ esc elt ^ "\"/>") (Text.set "topics" text) ""
    36   ^ "<content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\">"
    37   ^ P.of_string text.body ""
    38   ^ "</div></content></entry>\n"
     35  ^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ esc elt ^ "\"/>\n") (Text.set "topics" text) ""
     36  ^ "</entry>\n"
    3937
    4038let gmi_entry base_url text =
    4139  let open Logarion in
    4240  let u = Text.short_id text in
    43   "<entry><link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".gmi\" />"
     41  "<entry>\n<link rel=\"alternate\" href=\"" ^ base_url ^ "/" ^ u ^ ".gmi\" />\n"
    4442  ^ title text ^ id text ^ updated text ^ authors text
    4543  ^ (opt_element "summary" @@ esc @@ Text.str "abstract" text)
    46   ^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ elt ^ "\"/>") (Text.set "topics" text) ""
     44  ^ String_set.fold (fun elt a -> a ^ "<category term=\"" ^ elt ^ "\"/>\n") (Text.set "topics" text) ""
    4745  ^ "</entry>\n"
    4846
     
    6664          ^ title ^ {|</title><link rel="alternate" type="|} ^ alternate_type ^ {|" href="|}
    6765          ^ base_url ^ {|/" /><link rel="self" type="application/atom+xml" href="|}
    68           ^ self ^ {|" /><id>urn:uuid:|} ^ c.Conversion.id ^ "</id><updated>"
     66          ^ self ^ {|" /><id>urn:txtid:|} ^ c.Conversion.id ^ "</id><updated>"
    6967          ^ Logarion.Date.now () ^ "</updated>\n"
    7068          ^ List.fold_left (fun acc t -> acc ^ entry base_url t) "" c.texts
Note: See TracChangeset for help on using the changeset viewer.