{-# LANGUAGE RecordWildCards #-} module GalleryPage (make) where import BuilderQQ import Date import Info import qualified NsfwWarning import TagTransforms import Control.Monad import Data.Foldable import Data.Function ((&)) import qualified Data.HashMap.Strict as HashMap import qualified Data.HashSet as HashSet import Data.List (intersperse, sort, sortOn) import Data.Maybe import Data.Ord (Down (..)) import qualified Data.Text.Lazy as Lazy import System.FilePath (takeDirectory, joinPath, splitPath) make :: Text -> IndexInfo -> GalleryInfo -> [(FilePath, Info)] -> Lazy.Text make root iinfo ginfo infos = toLazyText $ make' root ginfo $ map (fmap $ transformInfoTags iinfo.tags) infos make' :: Text -> GalleryInfo -> [(FilePath, Info)] -> Builder make' root (GalleryInfo {title, desc, prefix, filters, hidden}) infos = [b| $nsfwScript