[英]How can I script math functionality in Clojure using Hiccup and Compojure?
[英]How Can I Output an HTML Comment in Compojure/Hiccup?
我希望我的程序輸出以下HTML:
<!--[if lt IE 8]><link rel="stylesheet" href="../blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
有沒有辦法用Hiccup輸出html評論文字?
只需插入它們。 也許這有點作弊,但它有效......
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>
你讓我很好奇,所以我重新閱讀了代碼:沒有明確的注釋函數 - 你必須將它作為字符串文字傳遞。 但你可以這樣做:
(defn comment
"Wrap the supplied HTML in a comment"
[html]
(str "<!--" html "-->"))
如果你真的需要這個功能(雖然這很簡單)。 您始終可以將IE if語句添加為可選參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.