在尝试呈现模板时,我遇到了https://hackage.haskell.org/package/snap-1.0.0.1/docs/Snap-Snaplet-Heist-Interpreted.html#v:render的问题。只有当我将以下内容作为模板的内容时,才会出现问题:
<!DOCTYPE html>
</html>而下面的内容呈现得很好
<html>
</html>因此,这似乎与HTML文档类型有关。
发生的异常:
*** Exception:
Initializer threw an exception...
/home/chris/Projects/Haskell/pkgscrape/Snap/snaplets/heist/templates/compareForm.tpl "/home/chris/Projects/Haskell/pkgscrape/Snap/snaplets/heist/templates/compareForm.tpl" (line 21, column 2):
unexpected "/"
CallStack (from HasCallStack):
error, called at src/Snap/Snaplet/Heist/Internal.hs:74:35 in snap-1.0.0.1-6iNEjVc81Z8CCk3FAMxZ8z:Snap.Snaplet.Heist.Internal
...but before it died it generated the following output:
Initializing myapp @ /
Initializing heist @ /heist
CallStack (from HasCallStack):
error, called at src/Snap/Snaplet/Internal/Initializer.hs:597:13 in snap-1.0.0.1-6iNEjVc81Z8CCk3FAMxZ8z:Snap.Snaplet.Internal.Initializer发布于 2017-01-23 22:51:57
您的第一个示例是无效的HTML。我认为你想要:
<!DOCTYPE html>
<html>
</html>doctype与开始<html>标记不同。
浏览器真的很宽松,所以他们会毫不犹豫地接受你的版本,但Interpreted Heist试图将模板解析成有效的超文本标记语言,所以它在没有正确的开始标签的情况下扼杀了结束标签(</html>)。
https://stackoverflow.com/questions/41808501
复制相似问题