use prefix in dependSingle'

This commit is contained in:
Rhiannon Morris 2020-07-15 20:09:14 +02:00
parent d360121efd
commit 966481dacd
1 changed files with 9 additions and 8 deletions

View File

@ -1,26 +1,27 @@
module Depend where module Depend where
import BuildVar
import Info hiding (Text) import Info hiding (Text)
import Data.Foldable
import System.FilePath import Data.Maybe (fromMaybe)
import Data.Text.Lazy (Text) import Data.Text.Lazy (Text)
import Data.Text.Lazy.Builder (toLazyText) import Data.Text.Lazy.Builder (toLazyText)
import BuildVar import System.FilePath
dependSingle' :: FilePath -- ^ yaml file name (relative to data dir!) dependSingle' :: FilePath -- ^ yaml file name (relative to data dir!)
-> Info -> Info
-> FilePath -- ^ output prefix
-> FilePath -- ^ build dir -> FilePath -- ^ build dir
-> Bool -- ^ include nsfw? -> Bool -- ^ include nsfw?
-> Text -> Text
dependSingle' yaml info build nsfw = dependSingle' yaml info prefix build nsfw =
let dir = build </> takeDirectory yaml let dir = build </> prefix </> takeDirectory yaml
images = if nsfw then #images info else filter #sfw $ #images info images = if nsfw then #images info else filter #sfw $ #images info
paths = map #path images paths = map #path images
index = dir </> "index.html" index = dir </> "index.html"
deps = map (dir </>) $ deps = thumbFile (thumbnail info) : map pageFile paths ++ paths
thumbFile (thumbnail info) : map pageFile paths ++ paths deps' = unwords $ map (dir </>) deps
deps' = unwords deps
in in
toLazyText [b|$@index: $@deps'|] toLazyText [b|$@index: $@deps'|]