add twitter [etc] card previews

This commit is contained in:
Rhiannon Morris 2020-08-11 20:29:54 +02:00
parent 8865b951fa
commit 5ad4e3dc30
9 changed files with 115 additions and 57 deletions

View file

@ -12,12 +12,15 @@ data Options =
data ModeOptions =
SinglePage {
root :: Text,
file :: FilePath,
prefix :: FilePath,
dataDir :: FilePath,
nsfw :: Bool,
output :: Maybe FilePath
}
| GalleryPage {
root :: Text,
files :: [FilePath],
prefix :: FilePath,
index :: FilePath,
@ -25,6 +28,7 @@ data ModeOptions =
dataDir :: FilePath
}
| IndexPage {
root :: Text,
file :: FilePath,
output :: Maybe FilePath
}
@ -72,9 +76,17 @@ optionsParser = globalOpts `info` mainInfo where
listTags
single = command "single" $ singleOpts `info` singleInfo
singleOpts = SinglePage <$> file <*> dataDir <*> nsfwS <*> output
singleOpts =
SinglePage <$> root <*> file <*> prefix <*> dataDir <*> nsfwS <*> output
root = strOption $
short 'R' <> long "root" <> metavar "URL" <>
help "website root (no trailing slash)"
file = strArgument $
metavar "FILE" <> help "yaml file to read"
prefix = strOption $
short 'p' <> long "prefix" <> metavar "DIR" <>
value "" <>
help "gallery directory prefix"
nsfwS = switch $
short 'n' <> long "nsfw" <>
help "include nsfw versions"
@ -85,16 +97,13 @@ optionsParser = globalOpts `info` mainInfo where
singleInfo = progDesc "generate a page for a single work"
index = command "index" $ indexOpts `info` indexInfo
indexOpts = IndexPage <$> file <*> output
indexOpts = IndexPage <$> root <*> file <*> output
indexInfo = progDesc "generate an index page for all galleries"
gallery = command "gallery" $ galleryOpts `info` galleryInfo
galleryOpts =
GalleryPage <$> files <*> prefix <*> indexFile <*> output <*> dataDir
prefix = strOption $
short 'p' <> long "prefix" <> metavar "DIR" <>
value "" <>
help "output directory prefix"
GalleryPage <$> root <*> files <*> prefix
<*> indexFile <*> output <*> dataDir
indexFile = strOption $
short 'i' <> long "index" <> metavar "FILE" <>
help "path to index file"
@ -105,9 +114,6 @@ optionsParser = globalOpts `info` mainInfo where
rss = command "rss" $ rssOpts `info` rssInfo
rssOpts = RSS <$> files <*> root <*> indexFile
<*> prefix <*> output <*> dataDir
root = strOption $
short 'R' <> long "root" <> metavar "URL" <>
help "website root (no trailing slash)"
rssInfo = progDesc "generate an rss file for a gallery"
dependSingle = command "depend-single" $ dsOpts `info` dsInfo