[atom feeds in syndication aren’t complete/correct ·𐑑𐑴𐑕𐑑𐑩𐑀 **20260617130557 Ignore-this: 3ba7c8d3ae151062c7994d220be21ad22b249cd6f5a79bc00584cc976cb3661b767550d26957769a ] hunk ./extra/darcs-hooks2/darcs-hooks2.factor 3 -USING: accessors ascii assocs combinators darcs-hooks2.util io io.directories -io.encodings.utf8 io.files io.launcher io.pathnames kernel namespaces sequences -splitting strings syndication xml xml.data xml.traversal xml.writer ; +USING: accessors arrays ascii assocs combinators darcs-hooks2.util io +io.directories io.encodings.utf8 io.files io.launcher io.pathnames kernel +math.order namespaces sequences splitting strings xml xml.data xml.traversal +xml.writer ; hunk ./extra/darcs-hooks2/darcs-hooks2.factor 47 - [ - "" >>url - "" >>description - swap - [ "name" tag-named children>string >>title ] keep - [ "date" attr >darcs-timestamp >>date ] keep - drop + [ + { + [ "name" tag-named children>string ] + [ "date" attr >darcs-timestamp ] + [ "hash" attr ] + } cleave + 3array hunk ./extra/darcs-hooks2/darcs-hooks2.factor 55 + ! tags-seq: { title date hash } + + dup [ second ] map supremum + ! tags-seq latest-date + + swap [ first3 tag-entry-xml ] map + ! latest-date entry-xmls + hunk ./extra/darcs-hooks2/darcs-hooks2.factor 64 - - pick >>url - swap >>title - nip - swap >>entries - feed>xml + ! latest-date entry-xmls url title + + + swap >>title + swap >>url + swap >>entries + swap >>updated + atom-feed>xml + hunk ./extra/darcs-hooks2/util/util.factor 3 -USING: calendar combinators kernel math math.order math.parser sequences ; +USING: accessors calendar calendar.format combinators kernel math math.order +math.parser sequences xml.syntax ; hunk ./extra/darcs-hooks2/util/util.factor 7 +TUPLE: atom-feed title url entries updated ; + +: ( -- atom-feed ) atom-feed new ; + +: atom-feed>xml ( feed -- xml ) + { + [ url>> ] + [ title>> ] + [ url>> ] + [ updated>> timestamp>rfc3339 ] + [ entries>> ] + } cleave + [XML + + <-> + <-> + /> + <-> + <-> + + XML] ; + +: tag-entry-xml ( title date hash -- xml ) + "urn:darcs-hash:" prepend + -rot + timestamp>rfc3339 + dup + [XML + + <-> + <-> + + <-> + <-> + + + XML] ; +