put link to index in footer of gallery pages
This commit is contained in:
parent
b44fd97029
commit
b62586b4ad
5 changed files with 27 additions and 12 deletions
|
@ -65,7 +65,8 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
|
||||||
$@path: $@pages' $@files' $@rss $$(MAKEPAGES)
|
$@path: $@pages' $@files' $@rss $$(MAKEPAGES)
|
||||||
echo "[gallery] "$$@
|
echo "[gallery] "$$@
|
||||||
mkdir -p $$(dir $$@)
|
mkdir -p $$(dir $$@)
|
||||||
$$(MAKEPAGES) $$(MPFLAGS) gallery -t "$*title" $flags -o "$$@" \
|
$$(MAKEPAGES) $$(MPFLAGS) gallery \
|
||||||
|
-p "$@prefix" -t "$*title" $flags -o "$$@" \
|
||||||
$$(filter $$(DATADIR)/%/$$(INFONAME),$$^)
|
$$(filter $$(DATADIR)/%/$$(INFONAME),$$^)
|
||||||
|
|
||||||
$@rss: $@files' $$(MAKEPAGES)
|
$@rss: $@files' $$(MAKEPAGES)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Control.Exception
|
||||||
import Data.Function (on, (&))
|
import Data.Function (on, (&))
|
||||||
import Data.List (sortOn, groupBy)
|
import Data.List (sortOn, groupBy)
|
||||||
import qualified Data.Text.Lazy as Lazy
|
import qualified Data.Text.Lazy as Lazy
|
||||||
import System.FilePath ((</>), takeDirectory)
|
import System.FilePath ((</>), takeDirectory, joinPath, splitPath)
|
||||||
import GHC.Exts (Down (..), the)
|
import GHC.Exts (Down (..), the)
|
||||||
|
|
||||||
import BuilderQQ
|
import BuilderQQ
|
||||||
|
@ -17,13 +17,14 @@ newtype NoThumb = NoThumb FilePath
|
||||||
instance Show NoThumb where show (NoThumb dir) = "no thumbnail for " ++ dir
|
instance Show NoThumb where show (NoThumb dir) = "no thumbnail for " ++ dir
|
||||||
|
|
||||||
make :: Text -- ^ title
|
make :: Text -- ^ title
|
||||||
|
-> FilePath -- ^ gallery url prefix
|
||||||
-> Bool -- ^ nsfw is included?
|
-> Bool -- ^ nsfw is included?
|
||||||
-> [(FilePath, Info)]
|
-> [(FilePath, Info)]
|
||||||
-> Lazy.Text
|
-> Lazy.Text
|
||||||
make title nsfw infos = toLazyText $ make' title nsfw infos
|
make title prefix nsfw infos = toLazyText $ make' title prefix nsfw infos
|
||||||
|
|
||||||
make' :: Text -> Bool -> [(FilePath, Info)] -> Builder
|
make' :: Text -> FilePath -> Bool -> [(FilePath, Info)] -> Builder
|
||||||
make' title nsfw infos = [b|@0
|
make' title prefix nsfw infos = [b|@0
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang=en>
|
<html lang=en>
|
||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
|
@ -45,6 +46,10 @@ make' title nsfw infos = [b|@0
|
||||||
$4.items
|
$4.items
|
||||||
</ul>
|
</ul>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<a href=$@undir>all galleries</a>
|
||||||
|
</footer>
|
||||||
|]
|
|]
|
||||||
where
|
where
|
||||||
items = map (uncurry $ makeYearItems nsfw) infosByYear
|
items = map (uncurry $ makeYearItems nsfw) infosByYear
|
||||||
|
@ -55,6 +60,7 @@ make' title nsfw infos = [b|@0
|
||||||
let year = #year info,
|
let year = #year info,
|
||||||
then group by Down year using groupBy']
|
then group by Down year using groupBy']
|
||||||
groupBy' f = groupBy ((==) `on` f)
|
groupBy' f = groupBy ((==) `on` f)
|
||||||
|
undir = joinPath (replicate (length (splitPath prefix)) "..")
|
||||||
|
|
||||||
makeYearItems :: Bool -- ^ nsfw
|
makeYearItems :: Bool -- ^ nsfw
|
||||||
-> Integer -- ^ year
|
-> Integer -- ^ year
|
||||||
|
|
|
@ -51,10 +51,10 @@ main2 (SinglePage {file, dataDir, nsfw, output}) = do
|
||||||
let page = SinglePage.make nsfw dir info
|
let page = SinglePage.make nsfw dir info
|
||||||
writeOutput output page
|
writeOutput output page
|
||||||
|
|
||||||
main2 (GalleryPage {title, files, nsfw, output, dataDir}) = do
|
main2 (GalleryPage {title, prefix, files, nsfw, output, dataDir}) = do
|
||||||
infos <- mapM (infoYAML dataDir) files
|
infos <- mapM (infoYAML dataDir) files
|
||||||
printV $ "infos" := infos
|
printV $ "infos" := infos
|
||||||
let page = GalleryPage.make title nsfw infos
|
let page = GalleryPage.make title prefix nsfw infos
|
||||||
writeOutput output page
|
writeOutput output page
|
||||||
|
|
||||||
main2 (IndexPage {file, output}) = do
|
main2 (IndexPage {file, output}) = do
|
||||||
|
|
|
@ -19,6 +19,7 @@ data ModeOptions =
|
||||||
}
|
}
|
||||||
| GalleryPage {
|
| GalleryPage {
|
||||||
files :: [FilePath],
|
files :: [FilePath],
|
||||||
|
prefix :: FilePath,
|
||||||
nsfw :: Bool,
|
nsfw :: Bool,
|
||||||
title :: Text,
|
title :: Text,
|
||||||
output :: Maybe FilePath,
|
output :: Maybe FilePath,
|
||||||
|
@ -84,7 +85,11 @@ optionsParser = globalOpts `info` mainInfo where
|
||||||
|
|
||||||
gallery = command "gallery" $ galleryOpts `info` galleryInfo
|
gallery = command "gallery" $ galleryOpts `info` galleryInfo
|
||||||
galleryOpts =
|
galleryOpts =
|
||||||
GalleryPage <$> files <*> nsfwG <*> title <*> output <*> dataDir
|
GalleryPage <$> files <*> prefix <*> nsfwG <*> title <*> output <*> dataDir
|
||||||
|
prefix = strOption $
|
||||||
|
short 'p' <> long "prefix" <> metavar "DIR" <>
|
||||||
|
value "" <>
|
||||||
|
help "output directory prefix"
|
||||||
files = many $ strArgument $
|
files = many $ strArgument $
|
||||||
metavar "FILE..." <> help "yaml files to read"
|
metavar "FILE..." <> help "yaml files to read"
|
||||||
nsfwG = switch $
|
nsfwG = switch $
|
||||||
|
@ -110,10 +115,6 @@ optionsParser = globalOpts `info` mainInfo where
|
||||||
dsOpts =
|
dsOpts =
|
||||||
DependSingle <$> file <*> nsfwS <*> output <*> prefix
|
DependSingle <$> file <*> nsfwS <*> output <*> prefix
|
||||||
<*> buildDir <*> dataDir
|
<*> buildDir <*> dataDir
|
||||||
prefix = strOption $
|
|
||||||
short 'p' <> long "prefix" <> metavar "DIR" <>
|
|
||||||
value "" <>
|
|
||||||
help "output directory prefix"
|
|
||||||
buildDir = strOption $
|
buildDir = strOption $
|
||||||
short 'B' <> long "build-dir" <> metavar "DIR" <> value "_build" <>
|
short 'B' <> long "build-dir" <> metavar "DIR" <> value "_build" <>
|
||||||
help "build directory (default: _build)"
|
help "build directory (default: _build)"
|
||||||
|
|
|
@ -89,6 +89,13 @@ figcaption {
|
||||||
mix-blend-mode: multiply;
|
mix-blend-mode: multiply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
font-size: 90%;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (hover) {
|
@media (hover) {
|
||||||
.item:hover figcaption {
|
.item:hover figcaption {
|
||||||
opacity: 20%;
|
opacity: 20%;
|
||||||
|
|
Loading…
Reference in a new issue