Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 对Hakyll中的模板使用标记_Haskell_Pandoc_Hakyll - Fatal编程技术网

Haskell 对Hakyll中的模板使用标记

Haskell 对Hakyll中的模板使用标记,haskell,pandoc,hakyll,Haskell,Pandoc,Hakyll,使用由hakyll init site\u foo生成的框架网站,我想将site\u foo/index.html翻译成markdown,并保留其内容 换句话说,有一个site\u foo/index.markdown引用posts列表模板 我不知道应该结合哪些函数来为匹配“index.markdown”实现正确的编译器如果您已经创建了索引.markdown文件来替换index.html,您可以将site.hs更改为: getResourceBody >>= applyAsT

使用由
hakyll init site\u foo
生成的框架网站,我想将
site\u foo/index.html
翻译成markdown,并保留其内容

换句话说,有一个
site\u foo/index.markdown
引用
posts列表
模板


我不知道应该结合哪些函数来为
匹配“index.markdown”
实现正确的
编译器
如果您已经创建了
索引.markdown
文件来替换
index.html
,您可以将
site.hs
更改为:

getResourceBody
    >>= applyAsTemplate indexCtx
    >>= return . renderPandoc
    >>= loadAndApplyTemplate "templates/default.html" indexCtx
    >>= relativizeUrls
新行是第三行,
>>=return。renderPandoc

Pandoc编译器将很好地呈现基于HTML的模板,但是您可能需要从基于HTML的模板中删除缩进,以便Pandoc不会将模板混淆为代码块

我已经使用并测试了此解决方案,但所有确定解决方案的功劳都归功于Jasper在Hakyll论坛上的回答: