Run pandoc on text instead of file
This commit is contained in:
parent
47420cbe41
commit
7825f62fa2
|
@ -262,5 +262,5 @@ copyFile' = runFunctionIO' CopyFile
|
|||
makeDir :: TokenableTo FilePath a => a -> DepGenM ()
|
||||
makeDir a = runFunctionIO' MakeDir =<< toToken a
|
||||
|
||||
runPandoc :: TokenableTo FilePath a => a -> DepGenM' Text
|
||||
runPandoc :: TokenableTo Text a => a -> DepGenM' Text
|
||||
runPandoc a = runFunctionIO RunPandoc =<< toToken a
|
||||
|
|
|
@ -51,8 +51,7 @@ evalFunctionIO f x = case (f, x) of
|
|||
createDirectory s
|
||||
pure Empty
|
||||
|
||||
(RunPandoc, String (StringWrapper s)) -> do
|
||||
contents <- T.readFile s
|
||||
(RunPandoc, Text contents) -> do
|
||||
html <- P.runIOorExplode (P.writeHtml5 P.def =<< P.readMarkdown (P.def { P.readerExtensions = P.extensionsFromList [ P.Ext_raw_html ] }) contents)
|
||||
pure $ Text $ TL.toStrict $ B.renderHtml html
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ handleRecipeDir inputDir outputDir template indexName name = do
|
|||
mapDepGenM_
|
||||
(\files -> convertImage files $ inject $ ResizeToWidth 800)
|
||||
(zipDepGenM imagePaths thumbnailImagePaths)
|
||||
htmlBodyBase <- runPandoc $ joinPaths dir $ inject "ret.md"
|
||||
htmlBodyBase <- runPandoc $ readTextFile $ joinPaths dir $ inject "ret.md"
|
||||
htmlBodyImages <- mapDepGenM makeImageHTML $ zipDepGenM thumbnailImageFilenames imageFilenames
|
||||
imagesHtml <- concatTexts htmlBodyImages
|
||||
htmlBody <- appendTexts htmlBodyBase imagesHtml
|
||||
|
@ -69,7 +69,7 @@ generateSite = do
|
|||
dirPathsAreSubdirs <- mapDepGenM isDirectory dirPaths
|
||||
dirNames' <- filterDepGenM dirPathsAreSubdirs dirNames
|
||||
mapDepGenM_ (handleRecipeDir recipesDir outputRecipesDir template indexName) dirNames'
|
||||
html <- applyTemplate template $ runPandoc $ inject "om.md"
|
||||
html <- applyTemplate template $ runPandoc $ readTextFile $ inject "om.md"
|
||||
aboutDir <- joinPaths outputDir $ inject "om"
|
||||
makeDir aboutDir
|
||||
saveFile html $ joinPaths aboutDir indexName
|
||||
|
|
Loading…
Reference in New Issue