Only use concat
This commit is contained in:
parent
d96af50943
commit
9240d66c15
|
@ -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
|
||||
|
||||
|
|
|
@ -17,15 +17,12 @@ thumbnailImageFilename filename = do
|
|||
makeImageHTML :: Token (FilePath, FilePath) -> DepGenM' Text
|
||||
makeImageHTML t = do
|
||||
(thumbnail, actual) <- untupleDepGenM t
|
||||
appendTexts
|
||||
(inject "<p class=\"image\"><a href=\"")
|
||||
(appendTexts
|
||||
(toText actual)
|
||||
(appendTexts
|
||||
(inject "\"><img src=\"")
|
||||
(appendTexts
|
||||
(toText thumbnail)
|
||||
(inject "\"></a></p>"))))
|
||||
concatTexts [ inject "<p class=\"image\"><a href=\""
|
||||
, toText actual
|
||||
, inject "\"><img src=\""
|
||||
, toText thumbnail
|
||||
, inject "\"></a></p>"
|
||||
]
|
||||
|
||||
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 "<p class=\"imagetext\">Opskrift fortsætter efter billedet.</p>\n")
|
||||
(appendTexts
|
||||
imagesHtml
|
||||
(appendTexts
|
||||
(inject "\n\n")
|
||||
ingredienserHeadline)))
|
||||
md' <- applyTemplate mdTemplate
|
||||
$ concatTexts [ inject "<p class=\"imagetext\">Opskrift fortsætter efter billedet.</p>\n"
|
||||
, pure imagesHtml
|
||||
, inject "\n\n"
|
||||
, pure ingredienserHeadline
|
||||
]
|
||||
htmlBody <- runPandoc md'
|
||||
html <- applyTemplate template htmlBody
|
||||
saveFile html $ joinPaths recipeDirOut indexName
|
||||
|
|
Loading…
Reference in New Issue