miniblog

Miniblog: A command-line static blog system in Common Lisp
Log | Files | Refs | README | LICENSE

rss.lxml (2001B)


      1 <rss version="2.0">
      2   <channel>
      3     <title><% @var title %></title>
      4     <link><% @var link %></link>
      5     <description><% @var description %></description>
      6     <generator>Miniblog</generator>
      7     <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
      8     <lastBuildDate>
      9       <% @var build-date %>
     10     </lastBuildDate>
     11     <% @if image-url %>
     12       <image>
     13         <url><% @var image-url %></url>
     14         <title><% @var title %></title>
     15         <link><% @var link %></link>
     16       </image>
     17     <% @endif %>
     18     <% @if language %>
     19       <language><% @var language %></language>
     20     <% @endif %>
     21     <% @if copyright %>
     22       <copyright><% @var copyright %></copyright>
     23     <% @endif %>
     24     <% @if managing-editor %>
     25       <managingEditor><% @var managing-editor %></managingEditor>
     26     <% @endif %>
     27     <% @if webmaster %>
     28       <webmaster><% @var webmaster %></webmaster>
     29     <% @endif %>
     30     <% @if category %>
     31       <category><% @var category %></category>
     32     <% @endif %>
     33     <% @if posts %>
     34       <pubDate>
     35         <% (let* ((latest (first (getf env :posts))) (pub-date (getf latest :last-updated-at-rfc-822))) %>
     36           <%= pub-date %>
     37         <% ) %>
     38       </pubDate>
     39       <% (loop for post in (getf env :posts) do %>
     40         <% (destructuring-bind (&key id title content last-updated-at &allow-other-keys) post %>
     41           <item>
     42             <% (let* ((formatted-content (funcall (getf env :content-formatter) content)) (stripped-content (funcall (getf env :content-stripper) formatted-content)) (truncated-content (str:substring 0 200 stripped-content))) %>
     43               <title><%= title %></title>
     44               <link><% @var link %>#<%= id %></link>
     45               <description><%= (if (equal stripped-content truncated-content) stripped-content (concatenate 'string truncated-content "...")) %></description>
     46               <pubDate><% @var last-updated-at-rfc-822 %></pubDate>
     47             <% ) %>
     48           </item>
     49         <% ) %>
     50       <% ) %>
     51     <% @endif %>
     52   </channel>
     53 </rss>