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