【问题标题】:Is there a function that transform from plain HTML to Hamlet structure?是否有从纯 HTML 转换为 Hamlet 结构的函数?
【发布时间】:2013-02-28 15:00:22
【问题描述】:

我开始使用 Yesod Web 框架。我有一些已经存在的模板 HTML 代码,我想将其自动转换为 Hamlet 代码结构。有没有办法做到这一点?

【问题讨论】:

  • 你现有的代码有哪些类型?
  • 纯 HTML,例如从模板中提取的那些,带有 JS 和 CSS
  • 我不确定,但也许这可以帮助你link,似乎有某种解析器

标签: haskell yesod hamlet


【解决方案1】:

这是一个可以完成大部分工作的解决方案

perl -pe 'chomp' test.html | xmllint --format --encode UTF-8 - | perl -pe 's#</[^>]+>##g'

来自https://github.com/yesodweb/yesod/wiki/Hamlet

【讨论】:

    猜你喜欢
    • 2015-12-30
    • 2011-04-01
    • 2011-07-08
    • 1970-01-01
    • 2013-05-10
    • 2021-04-23
    • 2022-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多