Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure 如何在Compojure/Hiccup中输出HTML注释?_Clojure_Compojure_Hiccup - Fatal编程技术网

Clojure 如何在Compojure/Hiccup中输出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

我希望我的程序输出以下HTML:

<!--[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
[:头
""]])