diff --git a/byg/src/DependencyGenerator.hs b/byg/src/DependencyGenerator.hs index 369c42a..c02365e 100644 --- a/byg/src/DependencyGenerator.hs +++ b/byg/src/DependencyGenerator.hs @@ -107,6 +107,9 @@ instance TokenableTo a (Token a) where instance TokenableTo [a] [Token a] where toToken = pure . ListToken +instance TokenableTo [a] [DepGenM' a] where + toToken = fmap ListToken . sequence + instance TokenableTo a (DepGenM' a) where toToken = id diff --git a/byg/src/SiteGenerator.hs b/byg/src/SiteGenerator.hs index 2966cbc..64cda74 100644 --- a/byg/src/SiteGenerator.hs +++ b/byg/src/SiteGenerator.hs @@ -17,15 +17,12 @@ thumbnailImageFilename filename = do makeImageHTML :: Token (FilePath, FilePath) -> DepGenM' Text makeImageHTML t = do (thumbnail, actual) <- untupleDepGenM t - appendTexts - (inject "

")))) + concatTexts [ inject "

" + ] hasExtension :: (TokenableTo [String] a, TokenableTo FilePath b) => a -> b -> DepGenM' Bool hasExtension exts filename = do @@ -53,14 +50,12 @@ handleRecipeDir inputDir outputDir template indexName name = do mdTemplate <- makeTemplate md ingredienserHeadline htmlBodyImages <- mapDepGenM makeImageHTML $ zipDepGenM thumbnailImageFilenames imageFilenames imagesHtml <- concatTexts htmlBodyImages - md' <- applyTemplate mdTemplate ( - appendTexts - (inject "

Opskrift fortsætter efter billedet.

\n") - (appendTexts - imagesHtml - (appendTexts - (inject "\n\n") - ingredienserHeadline))) + md' <- applyTemplate mdTemplate + $ concatTexts [ inject "

Opskrift fortsætter efter billedet.

\n" + , pure imagesHtml + , inject "\n\n" + , pure ingredienserHeadline + ] htmlBody <- runPandoc md' html <- applyTemplate template htmlBody saveFile html $ joinPaths recipeDirOut indexName