rename description to desc
This commit is contained in:
parent
49eff9c009
commit
87c3fa5b75
7 changed files with 38 additions and 38 deletions
|
@ -44,7 +44,7 @@ dependGallery ginfo infos build data_ tmp =
|
||||||
|
|
||||||
dependGallery' :: GalleryInfo -> [(FilePath, Info)]
|
dependGallery' :: GalleryInfo -> [(FilePath, Info)]
|
||||||
-> FilePath -> FilePath -> FilePath -> Builder
|
-> FilePath -> FilePath -> FilePath -> Builder
|
||||||
dependGallery' (GalleryInfo {title, description, prefix, filters})
|
dependGallery' (GalleryInfo {title, desc, prefix, filters})
|
||||||
infos' build data_ tmp =
|
infos' build data_ tmp =
|
||||||
let infos = filter (matchFilters filters . #second) infos'
|
let infos = filter (matchFilters filters . #second) infos'
|
||||||
files = map #first infos
|
files = map #first infos
|
||||||
|
@ -66,7 +66,7 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
|
||||||
$$(call gallery,$title',$@prefix,$flags)
|
$$(call gallery,$title',$@prefix,$flags)
|
||||||
|
|
||||||
$@rss: $@files' $$(MAKEPAGES)
|
$@rss: $@files' $$(MAKEPAGES)
|
||||||
$$(call rss,$title',$description',$@prefix,$@data_)
|
$$(call rss,$title',$desc',$@prefix,$@data_)
|
||||||
|
|
||||||
$rules
|
$rules
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
|
||||||
where
|
where
|
||||||
flags = filtersToFlags filters
|
flags = filtersToFlags filters
|
||||||
title' = substComma title
|
title' = substComma title
|
||||||
description' = substComma description
|
desc' = substComma desc
|
||||||
substComma = textMap \case ',' -> "$(comma)"; c -> fromChar c
|
substComma = textMap \case ',' -> "$(comma)"; c -> fromChar c
|
||||||
|
|
||||||
makeRules :: FilePath -- ^ prefix
|
makeRules :: FilePath -- ^ prefix
|
||||||
|
|
|
@ -51,8 +51,8 @@ make' (IndexInfo {title, galleries, links, footer}) = [b|@0
|
||||||
|]
|
|]
|
||||||
|
|
||||||
makeItem :: GalleryInfo -> Builder
|
makeItem :: GalleryInfo -> Builder
|
||||||
makeItem (GalleryInfo {title, description, prefix, filters}) = [b|@4
|
makeItem (GalleryInfo {title, desc, prefix, filters}) = [b|@4
|
||||||
<li$nsfw><a href=$@prefix title="$*description">$*title</a></li>
|
<li$nsfw><a href=$@prefix title="$*desc">$*title</a></li>
|
||||||
|]
|
|]
|
||||||
where nsfw = if hasNsfw filters then " class=nsfw" else ""
|
where nsfw = if hasNsfw filters then " class=nsfw" else ""
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,16 @@ import Text.Read (readMaybe)
|
||||||
|
|
||||||
data Info =
|
data Info =
|
||||||
Info {
|
Info {
|
||||||
date :: !Day,
|
date :: !Day,
|
||||||
title :: !Text,
|
title :: !Text,
|
||||||
artist :: !(Maybe Artist), -- nothing = me, obv
|
artist :: !(Maybe Artist), -- nothing = me, obv
|
||||||
tags :: ![Text],
|
tags :: ![Text],
|
||||||
nsfwTags :: ![Text],
|
nsfwTags :: ![Text],
|
||||||
description :: !(Maybe Text),
|
desc :: !(Maybe Text),
|
||||||
nsfwDescription :: !(Maybe Text),
|
nsfwDesc :: !(Maybe Text),
|
||||||
images :: ![Image],
|
images :: ![Image],
|
||||||
thumb' :: !(Maybe FilePath),
|
thumb' :: !(Maybe FilePath),
|
||||||
links :: ![Link]
|
links :: ![Link]
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ instance FromYAML Info where
|
||||||
<*> m .:? "artist"
|
<*> m .:? "artist"
|
||||||
<*> m .:? "tags" .!= []
|
<*> m .:? "tags" .!= []
|
||||||
<*> m .:? "nsfw-tags" .!= []
|
<*> m .:? "nsfw-tags" .!= []
|
||||||
<*> m .:? "description"
|
<*> m .:? "desc"
|
||||||
<*> m .:? "nsfw-description"
|
<*> m .:? "nsfw-desc"
|
||||||
<*> (m .: "images" >>= imageList)
|
<*> (m .: "images" >>= imageList)
|
||||||
<*> m .:? "thumb"
|
<*> m .:? "thumb"
|
||||||
<*> m .:? "links" .!= []
|
<*> m .:? "links" .!= []
|
||||||
|
@ -150,16 +150,16 @@ instance FromYAML Link where
|
||||||
|
|
||||||
data GalleryInfo =
|
data GalleryInfo =
|
||||||
GalleryInfo {
|
GalleryInfo {
|
||||||
title :: !Text,
|
title :: !Text,
|
||||||
description :: !Text,
|
desc :: !Text,
|
||||||
prefix :: !FilePath,
|
prefix :: !FilePath,
|
||||||
filters :: !GalleryFilters
|
filters :: !GalleryFilters
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data GalleryFilters =
|
data GalleryFilters =
|
||||||
GalleryFilters {
|
GalleryFilters {
|
||||||
nsfw :: !NsfwFilter,
|
nsfw :: !NsfwFilter,
|
||||||
artist :: !ArtistFilter,
|
artist :: !ArtistFilter,
|
||||||
require, exclude :: ![Text]
|
require, exclude :: ![Text]
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ matchFilters (GalleryFilters {nsfw, artist, require, exclude}) i =
|
||||||
instance FromYAML GalleryInfo where
|
instance FromYAML GalleryInfo where
|
||||||
parseYAML = YAML.withMap "gallery info" \m ->
|
parseYAML = YAML.withMap "gallery info" \m ->
|
||||||
GalleryInfo <$> m .: "title"
|
GalleryInfo <$> m .: "title"
|
||||||
<*> m .: "description"
|
<*> m .: "desc"
|
||||||
<*> m .: "prefix"
|
<*> m .: "prefix"
|
||||||
<*> m .:? "filters" .!= noFilters
|
<*> m .:? "filters" .!= noFilters
|
||||||
|
|
||||||
|
|
|
@ -63,11 +63,11 @@ main2 (IndexPage {file, output}) = do
|
||||||
let page = IndexPage.make info
|
let page = IndexPage.make info
|
||||||
writeOutput output page
|
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
|
infos <- mapM (infoYAML dataDir) files
|
||||||
printV $ "infos" := infos
|
printV $ "infos" := infos
|
||||||
let output' = takeFileName <$> output
|
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
|
writeOutput output rss
|
||||||
|
|
||||||
main2 (DependSingle {file, nsfw, output, prefix, buildDir, dataDir}) = do
|
main2 (DependSingle {file, nsfw, output, prefix, buildDir, dataDir}) = do
|
||||||
|
|
|
@ -30,13 +30,13 @@ data ModeOptions =
|
||||||
output :: Maybe FilePath
|
output :: Maybe FilePath
|
||||||
}
|
}
|
||||||
| RSS {
|
| RSS {
|
||||||
files :: [FilePath],
|
files :: [FilePath],
|
||||||
title :: Text,
|
title :: Text,
|
||||||
description :: Text,
|
desc :: Text,
|
||||||
root :: Text,
|
root :: Text,
|
||||||
prefix :: FilePath,
|
prefix :: FilePath,
|
||||||
output :: Maybe FilePath,
|
output :: Maybe FilePath,
|
||||||
dataDir :: FilePath
|
dataDir :: FilePath
|
||||||
}
|
}
|
||||||
| DependSingle {
|
| DependSingle {
|
||||||
file :: FilePath,
|
file :: FilePath,
|
||||||
|
|
|
@ -48,20 +48,20 @@ make' root title desc prefix output infos = [b|@0
|
||||||
|]
|
|]
|
||||||
|
|
||||||
makeItem :: Strict.Text -> FilePath -> FilePath -> Info -> Builder
|
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>
|
<item>
|
||||||
<title>$*title</title>
|
<title>$*title</title>
|
||||||
<link>$link</link>
|
<link>$link</link>
|
||||||
<guid>$link</guid>
|
<guid>$link</guid>
|
||||||
$description'
|
$desc'
|
||||||
<pubDate>$date'</pubDate>
|
<pubDate>$date'</pubDate>
|
||||||
</item>
|
</item>
|
||||||
|]
|
|]
|
||||||
where
|
where
|
||||||
dir = takeDirectory path
|
dir = takeDirectory path
|
||||||
link = [b|$*root/$@prefix/$@dir|]
|
link = [b|$*root/$@prefix/$@dir|]
|
||||||
description' =
|
desc' =
|
||||||
case description of
|
case desc of
|
||||||
Nothing -> ""
|
Nothing -> ""
|
||||||
Just d -> [b|@6
|
Just d -> [b|@6
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -31,7 +31,7 @@ make nsfw dir = toLazyText . make' nsfw dir
|
||||||
|
|
||||||
make' :: Bool -> FilePath -> Info -> Builder
|
make' :: Bool -> FilePath -> Info -> Builder
|
||||||
make' nsfw dir (Info {date, title, artist, tags, nsfwTags,
|
make' nsfw dir (Info {date, title, artist, tags, nsfwTags,
|
||||||
description, nsfwDescription, images, links}) = [b|@0
|
desc, nsfwDesc, images, links}) = [b|@0
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang=en>
|
<html lang=en>
|
||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
|
@ -84,7 +84,7 @@ make' nsfw dir (Info {date, title, artist, tags, nsfwTags,
|
||||||
download0 = fromMaybe path0 (#download image0)
|
download0 = fromMaybe path0 (#download image0)
|
||||||
path0' = pageFile path0
|
path0' = pageFile path0
|
||||||
|
|
||||||
descSection = makeDesc nsfw description nsfwDescription
|
descSection = makeDesc nsfw desc nsfwDesc
|
||||||
tagsList = makeTags nsfw tags nsfwTags
|
tagsList = makeTags nsfw tags nsfwTags
|
||||||
linksList = extLinks nsfw links
|
linksList = extLinks nsfw links
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue