rename description to desc

This commit is contained in:
Rhiannon Morris 2020-07-25 01:17:47 +02:00
parent 49eff9c009
commit 87c3fa5b75
7 changed files with 38 additions and 38 deletions

View file

@ -44,7 +44,7 @@ dependGallery ginfo infos build data_ tmp =
dependGallery' :: GalleryInfo -> [(FilePath, Info)]
-> FilePath -> FilePath -> FilePath -> Builder
dependGallery' (GalleryInfo {title, description, prefix, filters})
dependGallery' (GalleryInfo {title, desc, prefix, filters})
infos' build data_ tmp =
let infos = filter (matchFilters filters . #second) infos'
files = map #first infos
@ -66,7 +66,7 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
$$(call gallery,$title',$@prefix,$flags)
$@rss: $@files' $$(MAKEPAGES)
$$(call rss,$title',$description',$@prefix,$@data_)
$$(call rss,$title',$desc',$@prefix,$@data_)
$rules
@ -75,7 +75,7 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
where
flags = filtersToFlags filters
title' = substComma title
description' = substComma description
desc' = substComma desc
substComma = textMap \case ',' -> "$(comma)"; c -> fromChar c
makeRules :: FilePath -- ^ prefix

View file

@ -51,8 +51,8 @@ make' (IndexInfo {title, galleries, links, footer}) = [b|@0
|]
makeItem :: GalleryInfo -> Builder
makeItem (GalleryInfo {title, description, prefix, filters}) = [b|@4
<li$nsfw><a href=$@prefix title="$*description">$*title</a></li>
makeItem (GalleryInfo {title, desc, prefix, filters}) = [b|@4
<li$nsfw><a href=$@prefix title="$*desc">$*title</a></li>
|]
where nsfw = if hasNsfw filters then " class=nsfw" else ""

View file

@ -27,16 +27,16 @@ import Text.Read (readMaybe)
data Info =
Info {
date :: !Day,
title :: !Text,
artist :: !(Maybe Artist), -- nothing = me, obv
tags :: ![Text],
nsfwTags :: ![Text],
description :: !(Maybe Text),
nsfwDescription :: !(Maybe Text),
images :: ![Image],
thumb' :: !(Maybe FilePath),
links :: ![Link]
date :: !Day,
title :: !Text,
artist :: !(Maybe Artist), -- nothing = me, obv
tags :: ![Text],
nsfwTags :: ![Text],
desc :: !(Maybe Text),
nsfwDesc :: !(Maybe Text),
images :: ![Image],
thumb' :: !(Maybe FilePath),
links :: ![Link]
}
deriving (Eq, Show)
@ -100,8 +100,8 @@ instance FromYAML Info where
<*> m .:? "artist"
<*> m .:? "tags" .!= []
<*> m .:? "nsfw-tags" .!= []
<*> m .:? "description"
<*> m .:? "nsfw-description"
<*> m .:? "desc"
<*> m .:? "nsfw-desc"
<*> (m .: "images" >>= imageList)
<*> m .:? "thumb"
<*> m .:? "links" .!= []
@ -150,16 +150,16 @@ instance FromYAML Link where
data GalleryInfo =
GalleryInfo {
title :: !Text,
description :: !Text,
prefix :: !FilePath,
filters :: !GalleryFilters
title :: !Text,
desc :: !Text,
prefix :: !FilePath,
filters :: !GalleryFilters
}
deriving (Eq, Show)
data GalleryFilters =
GalleryFilters {
nsfw :: !NsfwFilter,
nsfw :: !NsfwFilter,
artist :: !ArtistFilter,
require, exclude :: ![Text]
}
@ -211,7 +211,7 @@ matchFilters (GalleryFilters {nsfw, artist, require, exclude}) i =
instance FromYAML GalleryInfo where
parseYAML = YAML.withMap "gallery info" \m ->
GalleryInfo <$> m .: "title"
<*> m .: "description"
<*> m .: "desc"
<*> m .: "prefix"
<*> m .:? "filters" .!= noFilters

View file

@ -63,11 +63,11 @@ main2 (IndexPage {file, output}) = do
let page = IndexPage.make info
writeOutput output page
main2 (RSS {files, title, description, root, prefix, output, dataDir}) = do
main2 (RSS {files, title, desc, root, prefix, output, dataDir}) = do
infos <- mapM (infoYAML dataDir) files
printV $ "infos" := infos
let output' = takeFileName <$> output
let rss = RSS.make root title description prefix output' infos
let rss = RSS.make root title desc prefix output' infos
writeOutput output rss
main2 (DependSingle {file, nsfw, output, prefix, buildDir, dataDir}) = do

View file

@ -30,13 +30,13 @@ data ModeOptions =
output :: Maybe FilePath
}
| RSS {
files :: [FilePath],
title :: Text,
description :: Text,
root :: Text,
prefix :: FilePath,
output :: Maybe FilePath,
dataDir :: FilePath
files :: [FilePath],
title :: Text,
desc :: Text,
root :: Text,
prefix :: FilePath,
output :: Maybe FilePath,
dataDir :: FilePath
}
| DependSingle {
file :: FilePath,

View file

@ -48,20 +48,20 @@ make' root title desc prefix output infos = [b|@0
|]
makeItem :: Strict.Text -> FilePath -> FilePath -> Info -> Builder
makeItem root prefix path (Info {title, description, date}) = [b|@4
makeItem root prefix path (Info {title, desc, date}) = [b|@4
<item>
<title>$*title</title>
<link>$link</link>
<guid>$link</guid>
$description'
$desc'
<pubDate>$date'</pubDate>
</item>
|]
where
dir = takeDirectory path
link = [b|$*root/$@prefix/$@dir|]
description' =
case description of
desc' =
case desc of
Nothing -> ""
Just d -> [b|@6
<description>

View file

@ -31,7 +31,7 @@ make nsfw dir = toLazyText . make' nsfw dir
make' :: Bool -> FilePath -> Info -> Builder
make' nsfw dir (Info {date, title, artist, tags, nsfwTags,
description, nsfwDescription, images, links}) = [b|@0
desc, nsfwDesc, images, links}) = [b|@0
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
@ -84,7 +84,7 @@ make' nsfw dir (Info {date, title, artist, tags, nsfwTags,
download0 = fromMaybe path0 (#download image0)
path0' = pageFile path0
descSection = makeDesc nsfw description nsfwDescription
descSection = makeDesc nsfw desc nsfwDesc
tagsList = makeTags nsfw tags nsfwTags
linksList = extLinks nsfw links