commit b75f3ee48e0b3093f45127022f706dea2a80d489 from: Omar Polo date: Sat Oct 03 14:01:31 2020 UTC teach rss about gemtext commit - 791e96fede5071fff98483a01a407aac77758281 commit + b75f3ee48e0b3093f45127022f706dea2a80d489 blob - 180422ed56ce7cc1c5839f871fdb8d7c79a9451f blob + 149e9941dc934d8db0a7ff5aeef4675ba1d9475f --- src/blog/rss.clj +++ src/blog/rss.clj @@ -1,17 +1,21 @@ (ns blog.rss - (:require [blog.time :as time] - [clojure.data.xml :refer :all] - [hiccup.core :as hiccup] - [commonmark-hiccup.core :refer [markdown->hiccup default-config]])) + (:require + [blog.gemtext :as gemtext] + [blog.time :as time] + [clojure.data.xml :refer :all] + [commonmark-hiccup.core :refer [markdown->hiccup default-config]] + [hiccup.core :as hiccup])) -(defn item [{:keys [title date slug tags short body]}] +(defn item [{:keys [title date slug tags short body gemtext?]}] (let [link (str "https://www.omarpolo.com/post/" slug ".html")] [:item [:title title] [:description [:-cdata (hiccup/html - (markdown->hiccup default-config body))]] + (if gemtext? + (-> body gemtext/parse gemtext/to-hiccup) + (markdown->hiccup default-config body)))]] [:guid link] [:link link] [:pubDate (time/fmt-rfc-2822 date)]]))