Created
November 8, 2014 22:51
-
-
Save butaji/f02676bb26fbda8bf443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app (:refer-clojure :exclude [meta tag])) | |
(defn attr [args] | |
(apply str (reduce str (map #(map (fn [[k v]] (str " " (name k) "='" v "'")) %) args)))) | |
(defn tag [x, args] | |
(str "<" x (attr (filter #(not (string? %)) args)) ">\n" (reduce str (filter string? args)) "</" x ">" "\n")) | |
(defn body [& args] | |
(tag "body" args)) | |
(defn head [& args] | |
(tag "head" args)) | |
(defn html [& args] | |
(str "<!DOCTYPE html>\n" | |
(tag "html" args) "\n")) | |
(defn title [& args] | |
(tag "title" args)) | |
(defn link [& args] | |
(tag "link" args)) | |
(defn h1 [& args] | |
(tag "h1" args)) | |
(defn script [& args] | |
(tag "script" args)) | |
(defn meta [& args] | |
(tag "meta" args)) | |
(println | |
(html {:lang "en"} | |
(head | |
(meta {:charset "utf-8"}) | |
(meta { :http-equiv "X-UA-Compatible", :content "IE=edge"}) | |
(meta { :name "viewport", :content "width=device-width, initial-scale=1"}) | |
(title "Bootstrap 101 Template") | |
(link { :href "css/bootstrap.min.css", :rel "stylesheet"}) | |
) | |
(body | |
(h1 "Hello, world!") | |
(script {:src "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"}) | |
(script {:src "js/bootstrap.min.js"}) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment