【问题标题】:Enlive and —活跃起来——
【发布时间】:2015-08-27 00:01:29
【问题描述】:

尝试添加一个 & mdash;在两个 div 之间使用 Enlive 但是

           {:tag :span,
             :attrs {:class "mdash"},
             :content "—"}

只返回实际文本 & mdash;而不是画一个——

想法?

【问题讨论】:

标签: html clojure enlive


【解决方案1】:

Enlive 会为普通的(content some-string) 转义&,因为这是正常的默认设置。

要设置原始 HTML 内容和转义字符,请使用 html-content,它在后台使用 html-snippet

示例

(html/html-snippet "&mdash;<p>hello</p>")

("—" {:tag :p,
      :attrs nil, 
      :content ("hello")})

【讨论】:

    猜你喜欢
    • 2010-12-28
    • 1970-01-01
    • 2012-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-23
    • 2013-11-12
    • 2015-02-15
    相关资源
    最近更新 更多