2017-01-23 30 views
0

我在尝试呈现模板时遇到https://hackage.haskell.org/package/snap-1.0.0.1/docs/Snap-Snaplet-Heist-Interpreted.html#v:render问题。而以下的内容呈现精细使用Snap/Heist模板呈现的HTML文档类型

<html> 
</html> 

因此,似乎有什么东西做的HTML文档类型

<!DOCTYPE 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 

回答

3

你的第一个例子是无效的HTML。我想你想:

<!DOCTYPE html> 
<html> 
</html> 

文档类型是不一样的开口<html>标签。

浏览器真的是宽容的,所以他们会接受你的版本而没有投诉,但Interpreted Heist试图将模板解析为有效的HTML,所以它会在没有正确开始标签的情况下扼杀结尾标签(</html>)。