Clojure 如何在Compojure/Hiccup中输出HTML注释?
我希望我的程序输出以下HTML:Clojure 如何在Compojure/Hiccup中输出HTML注释?,clojure,compojure,hiccup,Clojure,Compojure,Hiccup,我希望我的程序输出以下HTML: <!--[if lt IE 8]><link rel="stylesheet" href="../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> 有没有一种方法可以输出带有Hiccup的html注释文本?你让我好奇,所以我重新阅读了代码:没有显式的注释函数-你必须将其作为字符串文本传递。但你可以这样做: (defn com
<!--[if lt IE 8]><link rel="stylesheet" href="../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
有没有一种方法可以输出带有Hiccup的html注释文本?你让我好奇,所以我重新阅读了代码:没有显式的注释函数-你必须将其作为字符串文本传递。但你可以这样做:
(defn comment
"Wrap the supplied HTML in a comment"
[html]
(str "<!--" html "-->"))
(defn注释
“将提供的HTML包装在注释中”
[html]
(str“))
如果你真的需要这个函数(尽管这太简单了)。您可以随时添加IE if语句作为可选参数。只需插入它们即可。也许这有点作弊,但它是有效的
user=> (html
[:html
[:head
"<!--[if lt IE 8]>"
[:link {:rel "stylesheet"
:href "../blueprint/ie.css"
:type "text/css"
:media "screen,projection"}]
"<![endif]-->"]])
<html><head><!--[if lt IE 8]><link href=\"../blueprint/ie.css\" media=\"screen,projection\" rel=\"stylesheet\" type=\"text/css\" /><![endif]--></head></html>
user=>(html)
[:html
[:头
""]])