2017-01-23 32 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>)。