繁体   English   中英

使用Snap / Heist模板呈现的HTML文档类型

[英]HTML doctype rendered with Snap / Heist template

尝试呈现模板时, 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

您的第一个示例不是有效的HTML。 我想你要:

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

doctype与开头的<html>标记不同。

浏览器确实是允许的,因此他们会毫无保留地接受您的版本,但是Interpreted Heist会尝试将模板解析为有效的HTML,因此它会以结束标记( </html> )阻塞,而没有首先使用正确的开始标记。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM