gpt4 book ai didi

clojure - 打嗝代码没有响应没有(做(每个级别的html5

转载 作者:行者123 更新时间:2023-12-04 00:46:08 28 4
gpt4 key购买 nike

当我使用具有 for 循环的嵌套 let 语句时,如果没有 (do (html5 ..)),我将无法运行内部 [:tr]

(defpartial column-settings-layout [& content]

(html5
[:head
[:title "my-noir-proj"]
(include-css "assets/css/bootstrap.css")
]
[:body
[:div
[:div
[:image {:src "assets/img/ceva.gif" :alt "ceva-logo"}]
(toolbar)
]
[:div {:style "overflow: auto; overflow-x: hidden"}
content]
[:form {:id "col_settings_form" :name "col_settings_form" :method="post" :enctype="multipart/form-data"}
[:input {:type "button" :value "Save" :onclick "ajaxWithSerialize('save_cols_response_div','/save_cols_settings',$(col_settings_form).serialize());"}]
[:table {:class "table-striped" :border "1"}

[:tr [:td {:id "processing_status" } ][:td {:id "save_cols_response_div" :colspan 6} ]]
[:tr [:td ][:td {:colspan "3"} "SP" ] [:td {:colspan "3"} "WP"]]
(let [wp_settings (session/get :wp_settings)
sp_settings (session/get :sp_settings)]

(do (html5 [:tr [:td {:colspan "7"} "jhyghjghj"]]))
(for [col (:all_cols (session/get :setting_doc))]
(let
[
dest_station (keyword (session/get :dest_station))
;col_nm (:col_nm (nth col 1))
field_nm (nth col 0)
sp_col_nm (:col_nm (field_nm (dest_station sp_settings)))
wp_col_nm (:col_nm (field_nm (dest_station wp_settings)))
sp_editable (:editable (field_nm (dest_station sp_settings)))
wp_editable (:editable (field_nm (dest_station wp_settings)))

]
(do (html5 [:tr[:td "sfsdfgfds"]]
[:tr
[:th { :align "right" :class "input-small" } field_nm ]
[:td {:title sp_editable }[:input {:type "text" :class "input-large" :name (str "page_sp[" dest_station "][" field_nm "][col_nm]") :value sp_col_nm } ] ]
[:td [:input {:type "checkbox" :name (str "page_sp[" dest_station "][" field_nm "][col_nm]") :value field_nm}]]
[:td [:input {:type "checkbox" :name (str "page_sp[" dest_station "][" field_nm "][editable]") :value field_nm}]]
[:td {:title wp_editable }[:input {:type "text" :class "input-large" :name (str "page_wp[" dest_station "][" field_nm "][col_nm]") :value wp_col_nm} ] ]
[:td [:input {:type "checkbox" :name (str "page_wp[" dest_station "][" field_nm "][col_nm]") :value field_nm}]]
[:td [:input {:type "checkbox" :name (str "page_wp[" dest_station "][" field_nm "][editable]") :value field_nm}]]
]))
)
)

)
]
]
(footer)

;my includes of js and css
]]))

最佳答案

你的问题很可能是你试图做类似的事情

[:tr (for ... [:td .])]

导致打嗝格式无效

[:tr [[:td ..] [:td ..] ..]] ; note the vector of vectors inside the :tr

打嗝的地方

[:tr [:td ..] [:td ..] ..] ; :td vectors are direct elements of :tr

要获得预期的格式,您需要像

(into [:tr] (for ... [:td .]))

更新:您的 (html..) 构造也解决了这个问题的原因是它将格式化的 hiccup 标记的整个序列变成了单个 HTML 字符串。您可以删除 do - 它没有做任何有用的事情。

关于clojure - 打嗝代码没有响应没有(做(每个级别的html5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9805177/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com