From 34a16569970f151a5773705ebf438b79875c9b72 Mon Sep 17 00:00:00 2001 From: Esko Luontola Date: Thu, 30 Nov 2023 21:48:49 +0200 Subject: [PATCH] Reformat code --- src/hiccup/compiler.clj | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hiccup/compiler.clj b/src/hiccup/compiler.clj index 0f75fd7..a5bb1e7 100644 --- a/src/hiccup/compiler.clj +++ b/src/hiccup/compiler.clj @@ -39,7 +39,7 @@ (defmacro build-string [& strs] (let [strs (concatenate-strings strs) - w (gensym)] + w (gensym)] (case (count strs) 0 "" 1 (let [arg (first strs)] @@ -333,24 +333,24 @@ (defmethod compile-element ::literal-tag [[tag attrs & content]] (let [[tag tag-attrs _] (normalize-element-form [tag]) - attrs-sym (gensym "attrs")] + attrs-sym (gensym "attrs")] `(let [~attrs-sym ~attrs] (build-string - (if (map? ~attrs-sym) - ~(if (container-tag? tag content) - `(build-string ~(str "<" tag) - (render-attr-map (merge ~tag-attrs ~attrs-sym)) - ">") - `(build-string ~(str "<" tag) - (render-attr-map (merge ~tag-attrs ~attrs-sym)) - ~(end-tag))) - (build-string ~(str "<" tag (render-attr-map tag-attrs) ">") - ~@(compile-seq [attrs-sym]))) - ;; content and ending tag (when the above code did not emit an ending tag) - (when (or ~(boolean (container-tag? tag content)) - (not (map? ~attrs-sym))) - (build-string ~@(compile-seq content) - ~(str ""))))))) + (if (map? ~attrs-sym) + ~(if (container-tag? tag content) + `(build-string ~(str "<" tag) + (render-attr-map (merge ~tag-attrs ~attrs-sym)) + ">") + `(build-string ~(str "<" tag) + (render-attr-map (merge ~tag-attrs ~attrs-sym)) + ~(end-tag))) + (build-string ~(str "<" tag (render-attr-map tag-attrs) ">") + ~@(compile-seq [attrs-sym]))) + ;; content and ending tag (when the above code did not emit an ending tag) + (when (or ~(boolean (container-tag? tag content)) + (not (map? ~attrs-sym))) + (build-string ~@(compile-seq content) + ~(str ""))))))) (defmethod compile-element :default [element]