module RSS (make, make') where
import Date
import Info
import BuilderQQ
import Data.List (sortBy, intersperse)
import Data.Maybe (catMaybes)
import Data.Function (on)
import qualified Data.Text as Strict
import qualified Data.Text.Lazy as Lazy
import System.FilePath (takeDirectory)
import Control.Monad
make :: Strict.Text -- ^ website root e.g. @https://gallery.niss.website@
-> Strict.Text -- ^ website name e.g. @nissart@
-> GalleryInfo
-> Maybe FilePath -- ^ output filename for self link
-> [(FilePath, Info)]
-> Lazy.Text
make root name ginfo output infos =
toLazyText $ make' root name ginfo output infos
make' :: Strict.Text -> Strict.Text -> GalleryInfo
-> Maybe FilePath -> [(FilePath, Info)] -> Builder
make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|
by $name|] Artist name (Just url) -> [b|
by $name|] desc = makeDesc $ descFor nsfw info image = case previewImage info of Just (PFull img) -> figure $ pageFile img Just (PThumb th) -> figure $ thumbFile th Nothing -> "" figure p = [b||] makeDesc :: Desc -> Builder makeDesc NoDesc = "" makeDesc (TextDesc txt) = [b|$txt|] makeDesc (LongDesc fs) = [b|