[
  {
    "path": ".gitignore",
    "content": "*.jar\nresources/private/js/*\nclasses/\nout/\ntarget/\npom.xml\n.lein*\n.repl\n/classes\n/checkouts\npom.xml.asc\n*.class\n/.lein-*\n/.nrepl-port\n.hgignore\n.hg/\n/.idea\n*.iml\n.envrc\n/out"
  },
  {
    "path": "LICENSE.html",
    "content": "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\r\n<title>Eclipse Public License - Version 1.0</title>\r\n<style type=\"text/css\">\r\n  body {\r\n    size: 8.5in 11.0in;\r\n    margin: 0.25in 0.5in 0.25in 0.5in;\r\n    tab-interval: 0.5in;\r\n    }\r\n  p {  \t\r\n    margin-left: auto;\r\n    margin-top:  0.5em;\r\n    margin-bottom: 0.5em;\r\n    }\r\n  p.list {\r\n  \tmargin-left: 0.5in;\r\n    margin-top:  0.05em;\r\n    margin-bottom: 0.05em;\r\n    }\r\n  </style>\r\n\r\n</head>\r\n\r\n<body lang=\"EN-US\">\r\n\r\n<p align=center><b>Eclipse Public License - v 1.0</b></p>\r\n\r\n<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE\r\nPUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE, REPRODUCTION OR\r\nDISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS\r\nAGREEMENT.</p>\r\n\r\n<p><b>1. DEFINITIONS</b></p>\r\n\r\n<p>&quot;Contribution&quot; means:</p>\r\n\r\n<p class=\"list\">a) in the case of the initial Contributor, the initial\r\ncode and documentation distributed under this Agreement, and</p>\r\n<p class=\"list\">b) in the case of each subsequent Contributor:</p>\r\n<p class=\"list\">i) changes to the Program, and</p>\r\n<p class=\"list\">ii) additions to the Program;</p>\r\n<p class=\"list\">where such changes and/or additions to the Program\r\noriginate from and are distributed by that particular Contributor. A\r\nContribution 'originates' from a Contributor if it was added to the\r\nProgram by such Contributor itself or anyone acting on such\r\nContributor's behalf. Contributions do not include additions to the\r\nProgram which: (i) are separate modules of software distributed in\r\nconjunction with the Program under their own license agreement, and (ii)\r\nare not derivative works of the Program.</p>\r\n\r\n<p>&quot;Contributor&quot; means any person or entity that distributes\r\nthe Program.</p>\r\n\r\n<p>&quot;Licensed Patents&quot; mean patent claims licensable by a\r\nContributor which are necessarily infringed by the use or sale of its\r\nContribution alone or when combined with the Program.</p>\r\n\r\n<p>&quot;Program&quot; means the Contributions distributed in accordance\r\nwith this Agreement.</p>\r\n\r\n<p>&quot;Recipient&quot; means anyone who receives the Program under\r\nthis Agreement, including all Contributors.</p>\r\n\r\n<p><b>2. GRANT OF RIGHTS</b></p>\r\n\r\n<p class=\"list\">a) Subject to the terms of this Agreement, each\r\nContributor hereby grants Recipient a non-exclusive, worldwide,\r\nroyalty-free copyright license to reproduce, prepare derivative works\r\nof, publicly display, publicly perform, distribute and sublicense the\r\nContribution of such Contributor, if any, and such derivative works, in\r\nsource code and object code form.</p>\r\n\r\n<p class=\"list\">b) Subject to the terms of this Agreement, each\r\nContributor hereby grants Recipient a non-exclusive, worldwide,\r\nroyalty-free patent license under Licensed Patents to make, use, sell,\r\noffer to sell, import and otherwise transfer the Contribution of such\r\nContributor, if any, in source code and object code form. This patent\r\nlicense shall apply to the combination of the Contribution and the\r\nProgram if, at the time the Contribution is added by the Contributor,\r\nsuch addition of the Contribution causes such combination to be covered\r\nby the Licensed Patents. The patent license shall not apply to any other\r\ncombinations which include the Contribution. No hardware per se is\r\nlicensed hereunder.</p>\r\n\r\n<p class=\"list\">c) Recipient understands that although each Contributor\r\ngrants the licenses to its Contributions set forth herein, no assurances\r\nare provided by any Contributor that the Program does not infringe the\r\npatent or other intellectual property rights of any other entity. Each\r\nContributor disclaims any liability to Recipient for claims brought by\r\nany other entity based on infringement of intellectual property rights\r\nor otherwise. As a condition to exercising the rights and licenses\r\ngranted hereunder, each Recipient hereby assumes sole responsibility to\r\nsecure any other intellectual property rights needed, if any. For\r\nexample, if a third party patent license is required to allow Recipient\r\nto distribute the Program, it is Recipient's responsibility to acquire\r\nthat license before distributing the Program.</p>\r\n\r\n<p class=\"list\">d) Each Contributor represents that to its knowledge it\r\nhas sufficient copyright rights in its Contribution, if any, to grant\r\nthe copyright license set forth in this Agreement.</p>\r\n\r\n<p><b>3. REQUIREMENTS</b></p>\r\n\r\n<p>A Contributor may choose to distribute the Program in object code\r\nform under its own license agreement, provided that:</p>\r\n\r\n<p class=\"list\">a) it complies with the terms and conditions of this\r\nAgreement; and</p>\r\n\r\n<p class=\"list\">b) its license agreement:</p>\r\n\r\n<p class=\"list\">i) effectively disclaims on behalf of all Contributors\r\nall warranties and conditions, express and implied, including warranties\r\nor conditions of title and non-infringement, and implied warranties or\r\nconditions of merchantability and fitness for a particular purpose;</p>\r\n\r\n<p class=\"list\">ii) effectively excludes on behalf of all Contributors\r\nall liability for damages, including direct, indirect, special,\r\nincidental and consequential damages, such as lost profits;</p>\r\n\r\n<p class=\"list\">iii) states that any provisions which differ from this\r\nAgreement are offered by that Contributor alone and not by any other\r\nparty; and</p>\r\n\r\n<p class=\"list\">iv) states that source code for the Program is available\r\nfrom such Contributor, and informs licensees how to obtain it in a\r\nreasonable manner on or through a medium customarily used for software\r\nexchange.</p>\r\n\r\n<p>When the Program is made available in source code form:</p>\r\n\r\n<p class=\"list\">a) it must be made available under this Agreement; and</p>\r\n\r\n<p class=\"list\">b) a copy of this Agreement must be included with each\r\ncopy of the Program.</p>\r\n\r\n<p>Contributors may not remove or alter any copyright notices contained\r\nwithin the Program.</p>\r\n\r\n<p>Each Contributor must identify itself as the originator of its\r\nContribution, if any, in a manner that reasonably allows subsequent\r\nRecipients to identify the originator of the Contribution.</p>\r\n\r\n<p><b>4. COMMERCIAL DISTRIBUTION</b></p>\r\n\r\n<p>Commercial distributors of software may accept certain\r\nresponsibilities with respect to end users, business partners and the\r\nlike. While this license is intended to facilitate the commercial use of\r\nthe Program, the Contributor who includes the Program in a commercial\r\nproduct offering should do so in a manner which does not create\r\npotential liability for other Contributors. Therefore, if a Contributor\r\nincludes the Program in a commercial product offering, such Contributor\r\n(&quot;Commercial Contributor&quot;) hereby agrees to defend and\r\nindemnify every other Contributor (&quot;Indemnified Contributor&quot;)\r\nagainst any losses, damages and costs (collectively &quot;Losses&quot;)\r\narising from claims, lawsuits and other legal actions brought by a third\r\nparty against the Indemnified Contributor to the extent caused by the\r\nacts or omissions of such Commercial Contributor in connection with its\r\ndistribution of the Program in a commercial product offering. The\r\nobligations in this section do not apply to any claims or Losses\r\nrelating to any actual or alleged intellectual property infringement. In\r\norder to qualify, an Indemnified Contributor must: a) promptly notify\r\nthe Commercial Contributor in writing of such claim, and b) allow the\r\nCommercial Contributor to control, and cooperate with the Commercial\r\nContributor in, the defense and any related settlement negotiations. The\r\nIndemnified Contributor may participate in any such claim at its own\r\nexpense.</p>\r\n\r\n<p>For example, a Contributor might include the Program in a commercial\r\nproduct offering, Product X. That Contributor is then a Commercial\r\nContributor. If that Commercial Contributor then makes performance\r\nclaims, or offers warranties related to Product X, those performance\r\nclaims and warranties are such Commercial Contributor's responsibility\r\nalone. Under this section, the Commercial Contributor would have to\r\ndefend claims against the other Contributors related to those\r\nperformance claims and warranties, and if a court requires any other\r\nContributor to pay any damages as a result, the Commercial Contributor\r\nmust pay those damages.</p>\r\n\r\n<p><b>5. NO WARRANTY</b></p>\r\n\r\n<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS\r\nPROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS\r\nOF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,\r\nANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY\r\nOR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely\r\nresponsible for determining the appropriateness of using and\r\ndistributing the Program and assumes all risks associated with its\r\nexercise of rights under this Agreement , including but not limited to\r\nthe risks and costs of program errors, compliance with applicable laws,\r\ndamage to or loss of data, programs or equipment, and unavailability or\r\ninterruption of operations.</p>\r\n\r\n<p><b>6. DISCLAIMER OF LIABILITY</b></p>\r\n\r\n<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT\r\nNOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,\r\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING\r\nWITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF\r\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR\r\nDISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED\r\nHEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>\r\n\r\n<p><b>7. GENERAL</b></p>\r\n\r\n<p>If any provision of this Agreement is invalid or unenforceable under\r\napplicable law, it shall not affect the validity or enforceability of\r\nthe remainder of the terms of this Agreement, and without further action\r\nby the parties hereto, such provision shall be reformed to the minimum\r\nextent necessary to make such provision valid and enforceable.</p>\r\n\r\n<p>If Recipient institutes patent litigation against any entity\r\n(including a cross-claim or counterclaim in a lawsuit) alleging that the\r\nProgram itself (excluding combinations of the Program with other\r\nsoftware or hardware) infringes such Recipient's patent(s), then such\r\nRecipient's rights granted under Section 2(b) shall terminate as of the\r\ndate such litigation is filed.</p>\r\n\r\n<p>All Recipient's rights under this Agreement shall terminate if it\r\nfails to comply with any of the material terms or conditions of this\r\nAgreement and does not cure such failure in a reasonable period of time\r\nafter becoming aware of such noncompliance. If all Recipient's rights\r\nunder this Agreement terminate, Recipient agrees to cease use and\r\ndistribution of the Program as soon as reasonably practicable. However,\r\nRecipient's obligations under this Agreement and any licenses granted by\r\nRecipient relating to the Program shall continue and survive.</p>\r\n\r\n<p>Everyone is permitted to copy and distribute copies of this\r\nAgreement, but in order to avoid inconsistency the Agreement is\r\ncopyrighted and may only be modified in the following manner. The\r\nAgreement Steward reserves the right to publish new versions (including\r\nrevisions) of this Agreement from time to time. No one other than the\r\nAgreement Steward has the right to modify this Agreement. The Eclipse\r\nFoundation is the initial Agreement Steward. The Eclipse Foundation may\r\nassign the responsibility to serve as the Agreement Steward to a\r\nsuitable separate entity. Each new version of the Agreement will be\r\ngiven a distinguishing version number. The Program (including\r\nContributions) may always be distributed subject to the version of the\r\nAgreement under which it was received. In addition, after a new version\r\nof the Agreement is published, Contributor may elect to distribute the\r\nProgram (including its Contributions) under the new version. Except as\r\nexpressly stated in Sections 2(a) and 2(b) above, Recipient receives no\r\nrights or licenses to the intellectual property of any Contributor under\r\nthis Agreement, whether expressly, by implication, estoppel or\r\notherwise. All rights in the Program not expressly granted under this\r\nAgreement are reserved.</p>\r\n\r\n<p>This Agreement is governed by the laws of the State of New York and\r\nthe intellectual property laws of the United States of America. No party\r\nto this Agreement will bring a legal action under this Agreement more\r\nthan one year after the cause of action arose. Each party waives its\r\nrights to a jury trial in any resulting litigation.</p>\r\n\r\n</body>\r\n\r\n</html>\r\n"
  },
  {
    "path": "README.md",
    "content": "Hiccups\n=======\n\nHiccups is a ClojureScript port of the [Hiccup](https://github.com/weavejester/hiccup) HTML generation library.\nIt uses vectors to represent tags, and maps to represent a tag's attributes.\n\nThe goal is to provide similar performance to Closure Templates with a much more Clojure friendly\nsyntax.\n\nDifferences from Hiccup\n-----------------------\n\n* In ClojureScript, macros need to be defined in separate Clojure namespaces. Because of this,\n  core functionality is split into two files: `core.clj` contains the macros and compile-time only\n  functions, and `runtime.cljs` contains functions that are also available at runtime. The contents\n  of `runtime.cljs` are also used at compile-time, so the goal is to keep it portable between\n  ClojureScript and Clojure.\n* Unit tests are run in a PhantomJS browser using [lein-cljsbuild](https://github.com/emezeske/lein-cljsbuild/) and Closure's testing libs.\n* Not everything has been ported yet. See ToDo.\n\nAlternatives\n------------\n\n* [Crate](https://github.com/ibdknox/crate) is an alternative Hiccup style library for ClojureScript. The main difference\n  between Crate and Hiccups is that Crate generates DOM nodes and Hiccups generates strings. There are a few reasons why you might consider Hiccups over Crate (YMMV, of course):\n  * As with the original Hiccup, Hiccups tries to do as much as possible at compile time, with macro expansion.\n  * Working with strings can be much more\n  performant than working with DOM nodes, especially with large amounts of markup, and\n  [especially with older browsers](http://www.quirksmode.org/dom/innerhtml.html).\n  * Easier to use in headless environments like Node.js\n* [Closure Templates](http://code.google.com/closure/templates/) is Google's Closure templating library.\n\nInstall\n-------\n\nAdd the following dependency to your `project.clj` file:\n\n```clojure\n[hiccups \"0.3.0\"]\n```\n\nUsage\n-----\n\nRequire both the core macros and the runtime functions in your namespace declaration:\n\n```clojure\n(ns myns\n  (:require-macros [hiccups.core :as hiccups :refer [html]])\n  (:require [hiccups.runtime :as hiccupsrt]))\n\n(hiccups/defhtml my-template []\n  [:div\n    [:a {:href \"https://github.com/weavejester/hiccup\"}\n      \"Hiccup\"]])\n```\n\nSyntax\n------\n\nHere is a basic example of Hiccups syntax:\n\n```clojure\n(html [:span {:class \"foo\"} \"bar\"])\n\"<span class=\\\"foo\\\">bar</span>\"\n```\n\nThe first element of the vector is used as the tag name. The second\nattribute can optionally be a map, in which case it is used to supply\nthe tag's attributes. Every other element is considered part of the\ntag's body.\n\nHiccups is intelligent enough to render different HTML tags in different\nways, in order to accommodate browser quirks:\n\n```clojure\n(html [:script])\n\"<script></script>\"\n(html [:p])\n\"<p />\"\n```\n\nAnd provides a CSS-like shortcut for denoting `id` and `class`\nattributes:\n\n```clojure\n(html [:div#foo.bar.baz \"bang\"])\n\"<div id=\\\"foo\\\" class=\\\"bar baz\\\">bang</div>\"\n```\n\nIf the body of the tag is a seq, its contents will be expanded out into\nthe tag body. This makes working with forms like `map` and `for` more\nconvenient:\n\n```clojure\n(html [:ul\n        (for [x (range 1 4)]\n          [:li x])])\n\"<ul><li>1</li><li>2</li><li>3</li></ul>\"\n```\n\nNote that while lists are considered to be seqs in Clojure(Script), vectors and sets are not. As a consequence, Hiccups will bail out if a vector is passed in without a tag: `[[:div] [:div]]`.\n\nSee the [Hiccup wiki](https://github.com/weavejester/hiccup/wiki) for more information.\n\nToDo\n----\n\n* Catch up with recent changes in Hiccup.\n* Form helpers\n* Page helpers\n* Figure out if the runtime can be pulled in without an explicit require by the user\n* Explore potential performance improvements using Google's StringBuffer et al.\n\n"
  },
  {
    "path": "build.boot",
    "content": "(def project 'hiccups)\n(def version \"0.3.1\")\n\n(set-env! :resource-paths #{\"resources\" \"src/cljs\" \"src/clj\"}\n          :source-paths #{\"test\"}\n          :asset-paths #{\"html\"}\n          :dependencies '[[org.clojure/clojure \"1.8.0\"]\n                          [org.clojure/clojurescript \"1.8.40\"]\n                          [adzerk/boot-test \"RELEASE\" :scope \"test\"]\n                          [adzerk/boot-cljs \"1.7.228-1\" :scope \"test\"]\n                          [adzerk/boot-cljs-repl \"0.3.0\" :scope \"test\"]\n                          [com.cemerick/piggieback \"0.2.1\" :scope \"test\"]\n                          [weasel \"0.7.0\" :scope \"test\"]\n                          [org.clojure/tools.nrepl \"0.2.12\" :scope \"test\"]\n                          [adzerk/boot-reload \"0.4.5\" :scope \"test\"]\n                          [pandeiro/boot-http \"0.7.0\" :scope \"test\"]\n                          [cljsjs/boot-cljsjs \"0.5.1\" :scope \"test\"]\n                          [provisdom/boot-tasks \"0.5.1\" :scope \"test\"]])\n\n(task-options!\n  pom {:project     project\n       :version     version\n       :description \"FIXME: write description\"\n       :url         \"http://example/FIXME\"\n       :scm         {:url \"https://github.com/yourname/tree-graph\"}\n       :license     {\"Eclipse Public License\"\n                     \"http://www.eclipse.org/legal/epl-v10.html\"}})\n\n(require\n  '[adzerk.boot-cljs :refer :all]\n  '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]\n  '[adzerk.boot-reload :refer :all]\n  '[pandeiro.boot-http :refer :all]\n  '[cljsjs.boot-cljsjs :refer :all]\n  '[provisdom.boot-tasks.core :refer :all])\n\n(deftask web-dev\n         \"Developer workflow for web-component UX.\"\n         []\n         (comp\n           (serve :dir \"target/\")\n           (watch)\n           (cljs-repl)\n           (speak)\n           (reload)\n           (cljs)\n           (target)))"
  },
  {
    "path": "dev-resources/public/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\">\n    <title>bREPL Connection</title>\n    <!--[if lt IE 9]>\n    <script src=\"http://html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n    <![endif]-->\n</head>\n\n<body>\n    <div id=\"test\">\n        <h1>ClojureScript</h1>\n    </div>\n    <script src=\"js/hiccups.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "dev-resources/tools/http/ring/server.clj",
    "content": ";;; This namespace is used for development and testing purpose only.\n(ns ring.server\n  (:require [cemerick.austin.repls :refer (browser-connected-repl-js)]\n            [net.cgrand.enlive-html :as enlive]\n            [compojure.route :refer  (resources)]\n            [compojure.core :refer (GET defroutes)]\n            [ring.adapter.jetty :as jetty]\n            [clojure.java.io :as io]))\n\n;;; We use enlive lib to add to the body of the index.html page the\n;;; script tag containing the JS code which activates the bREPL\n;;; connection.\n(enlive/deftemplate page\n  (io/resource \"public/index.html\")\n  []\n  [:body] (enlive/append\n            (enlive/html [:script (browser-connected-repl-js)])))\n\n;;; defroutes macro defines a function that chains individual route\n;;; functions together. The request map is passed to each function in\n;;; turn, until a non-nil response is returned.\n(defroutes site\n  (resources \"/\")\n  (GET \"/*\" req (page)))\n\n;;; To run the jetty server. The server symbol is not private to\n;;; allows to start and stop thejetty server from the repl.\n(defn run\n  \"Run the ring server. It defines the server symbol with defonce.\"\n  []\n  (defonce server\n    (jetty/run-jetty #'site {:port 3000 :join? false}))\n  server)\n"
  },
  {
    "path": "dev-resources/tools/repl/brepl/connect.cljs",
    "content": ";;; This namespace is for creating the connection with the browser. It\n;;; lives in the dev-resources/tools/brepl directory. It is used in the\n;;; :dev profile only.\n(ns brepl.connect\n  (:require [clojure.browser.repl]))\n\n;;(repl/connect \"http://localhost:9000/repl\")\n"
  },
  {
    "path": "profiles.clj",
    "content": ";;; ****************************** NOTES ******************************\n;;;\n;;; The hiccups/profiles.clj file is used for keeping the developer\n;;; view of your cljs lib separated from its user view. This way the\n;;; user of your lib does not even see the complexity of the developer\n;;; view of the lib.  The hiccups/profiles.clj should never contain\n;;; any configuration for the :user profile. The content of\n;;; hiccups/profiles.clj will be merge with the content from the\n;;; ~/.lein/profiles.clj and hiccups/project.clj. Keep in mind that\n;;; any in case of conflicts, the hiccups/profiles.clj takes\n;;; precedence over the hiccups/project.clj which, in turn, takes\n;;; precedence over the ~/.lein/profiles.clj\n;;;\n;;; *******************************************************************\n\n{:dev { ;; Add the out dir to the dirs to be cleaned by the lein clean\n        ;; command. Add here any pathname containing generated files\n        ;; to be cleaned by the lein clean command.\n       :clean-targets [\"out\"]\n       ;; Add the test/clj and test/cljs dir to the leiningen\n       ;; :test-paths option. It has to contain also the superset of\n       ;; all the pathnames used for CLJS purpose. See below the\n       ;; comment on Leiningen :source-paths.\n       :test-paths [\"test/clj\" \"test/cljs\"]\n       ;; We need to add dev-resources/tools/repl, because cljsbuild\n       ;; does not add its own source-paths to the project\n       ;; source-paths.\n       :source-paths [\"dev-resources/tools/http\" \"dev-resources/tools/repl\"]\n       ;; Add the dev-resources to the project classpath.\n       :resources-paths [\"dev-resources\"]\n       ;; To instrument the project with the brepl facilities\n       ;; (i.e. the ring/compojure/enlive libs) and the austin plugin\n       ;; (cf. see below)\n       :dependencies [[ring \"1.2.1\"]\n                      [compojure \"1.1.6\"]\n                      [enlive \"1.1.4\"]]\n\n       ;; The lib for cljs unit testing which is a maximal port of\n       ;; clojure.test standard lib; \n       ;; The lib for instrumenting the brepl\n       :plugins [[com.cemerick/clojurescript.test \"0.2.1\"]\n                 [com.cemerick/austin \"0.1.3\"]]\n\n       ;; Cljsbuild settings for development and test phases\n       :cljsbuild\n       {;; Here we configure one build for each compiler optmizations\n        ;; options. We do not include the :none optimization.\n        :builds {;; The :whitespace optimizations build. This is the\n                 ;; only build included in the index.html page used\n                 ;; for the brepl connection\n                 :whitespace\n                 {:source-paths [\"src/cljs\" \"test/cljs\" \"dev-resources/tools/repl\"]\n                  :compiler\n                  {:output-to \"dev-resources/public/js/hiccups.js\"\n                   :optimizations :whitespace\n                   :pretty-print true}}\n                 ;; The :simple optimizations build\n                 :simple\n                 {:source-paths [\"src/cljs\" \"test/cljs\"]\n                  :compiler\n                  {:output-to \"dev-resources/public/js/simple.js\"\n                   :optimizations :simple\n                   :pretty-print false}}\n                 ;; The :advanced optimizations build\n                 :advanced\n                 {:source-paths [\"src/cljs\" \"test/cljs\"]\n                  :compiler\n                  {:output-to \"dev-resources/public/js/advanced.js\"\n                   :optimizations :advanced\n                   :pretty-print false}}}\n\n        ;; Here we configure the test commands for running the\n        ;; test. To be able to use this commands you have to install\n        ;; phantomjs on you development machine. Phantomjs is the most\n        ;; used webkit-based headless browser for unit testing JS code\n        :test-commands {;; test :whitespace build against phantomjs\n                        \"phantomjs-ws\"\n                        [\"phantomjs\" :runner \"dev-resources/public/js/hiccups.js\"]\n                        ;; test :simple build against phantomjs\n                        \"phantomjs-simple\"\n                        [\"phantomjs\" :runner \"dev-resources/public/js/simple.js\"]\n                        ;; test advanced build against phantomjs\n                        \"phantomjs-advanced\"\n                        [\"phantomjs\" :runner \"dev-resources/public/js/advanced.js\"]}}\n\n       :injections [(require '[ring.server :as http :refer [run]]\n                             'cemerick.austin.repls)\n                    (defn browser-repl []\n                      (cemerick.austin.repls/cljs-repl (reset! cemerick.austin.repls/browser-repl-env\n                                                               (cemerick.austin/repl-env))))]}}\n"
  },
  {
    "path": "project.clj",
    "content": "(defproject hiccups \"0.3.1\"\n  :description \"A ClojureScript port of Hiccup - a fast library for rendering HTML in ClojureScript\"\n  :url \"http://example.com/FIXME\"\n  :license {:name \"Eclipse Public License - v 1.0\"\n            :url \"http://www.eclipse.org/legal/epl-v10.html\"\n            :distribution :repo}\n\n  ;; Required by cljsbuild  plugin\n  :min-lein-version \"2.2.0\"\n\n  ;; We need to add src/cljs too, because cljsbuild does not add its\n  ;; source-paths to the project source-paths\n  :source-paths [\"src/clj\" \"src/cljs\"]\n\n  ;; The libs which the project depends on.\n  ;; Here we use the latest stable clj and cljs releases\n  :dependencies [[org.clojure/clojure \"1.5.1\"]\n                 [org.clojure/clojurescript \"0.0-2069\"]]\n\n  ;; The plugins which the project depends on. Here we're using the\n  ;; experimental 1.0.0-alpha2 release. Change it to the official\n  ;; 1.0.0 as soon as it will be available\n  :plugins [[lein-cljsbuild \"1.0.0\"]]\n\n  ;; Hooks the cljsbuild subtasks to the lein tasks: lein clean, lein\n  ;; compile, lein test and lein jar\n  :hooks [leiningen.cljsbuild]\n\n  ;; Lein-cljsbuild plugin configuration. Here we define one build\n  ;; only: the one used for packaging any cljs sources in the jar\n  ;; generated by lein jar command\n  :cljsbuild\n  {:builds {;; This build is only used for including any cljs source\n            ;; in the packaged jar when you issue lein jar command and\n            ;; any other command that depends on it\n            :useless\n            {;; The dir pathnames where cljs sources live. Do not\n             ;; include here any cljs source which is only used during\n             ;; development or testing\n             :source-paths [\"src/cljs\"]\n             ;; The :jar true option is not needed to include the CLJS\n             ;; sources in the packaged jar. This is because we added\n             ;; the CLJS source codebase to the Leiningen\n             ;; :source-paths\n             ;:jar true\n             ;; Compilation Options\n             :compiler\n             {;; The JS file pathname emitted by the compiler\n              :output-to \"dev-resources/public/js/useless.js\"\n              ;; Compiler optimizations option set to :none to speed\n              ;; up this useless compilation\n              :optimizations :none\n              ;; No need to prettify the emitted js file\n              :pretty-print false}}}})\n"
  },
  {
    "path": "src/clj/hiccups/core.clj",
    "content": "(ns hiccups.core\n  \"Library for rendering a tree of vectors into a string of HTML.\n   Pre-compiles where possible for performance.\n   Core macros and their (Clojure) helper functions.\"\n  (:require [hiccups.runtime :as rt])\n  (:import [clojure.lang IPersistentVector ISeq]))\n\n(def doctype\n  {:html4\n   (str \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD HTML 4.01//EN\\\" \"\n        \"\\\"http://www.w3.org/TR/html4/strict.dtd\\\">\\n\")\n   :xhtml-strict\n   (str \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\" \"\n        \"\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\\\">\\n\")\n   :xhtml-transitional\n   (str \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \"\n        \"\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\\n\")\n   :html5\n   \"<!DOCTYPE html>\\n\"})\n\n(defn wrap-attrs\n  \"Add an optional attribute argument to a function that returns a element vector.\"\n  [func]\n  (fn [& args]\n    (if (map? (first args))\n      (let [[tag & body] (apply func (rest args))]\n        (if (map? (first body))\n          (apply vector tag (merge (first body) (first args)) (rest body))\n          (apply vector tag (first args) body)))\n      (apply func args))))\n\n(defn- update-arglists [arglists]\n  (for [args arglists]\n    (vec (cons 'attr-map? args))))\n\n(defmacro defelem\n  \"Defines a function that will return a element vector. If the first argument\n  passed to the resulting function is a map, it merges it with the attribute\n  map of the returned element value.\"\n  [name & fdecl]\n  `(do (defn ~name ~@fdecl)\n       (alter-meta! (var ~name) update-in [:arglists] #'update-arglists)\n       (alter-var-root (var ~name) wrap-attrs)))\n\n(defelem xhtml-tag\n  \"Create an XHTML element for the specified language.\"\n  [lang & contents]\n  [:html {:xmlns \"http://www.w3.org/1999/xhtml\"\n          \"xml:lang\" lang\n          :lang lang}\n    contents])\n\n(defn xml-declaration\n  \"Create a standard XML declaration for the following encoding.\"\n  [encoding]\n  (str \"<?xml version=\\\"1.0\\\" encoding=\\\"\" encoding \"\\\"?>\\n\"))\n\n(defmacro html4\n  \"Create a HTML 4 document with the supplied contents. The first argument\n  may be an optional attribute map.\"\n  [& contents]\n  `(html {:mode :sgml}\n     ~(doctype :html4)\n     [:html ~@contents]))\n\n(defmacro xhtml\n  \"Create a XHTML 1.0 strict document with the supplied contents. The first\n  argument may be an optional attribute may. The following attributes are\n  treated specially:\n    :lang     - The language of the document\n    :encoding - The character encoding of the document, defaults to UTF-8.\"\n  [options & contents]\n  (if-not (map? options)\n    `(xhtml {} ~options ~@contents)\n    `(let [options# ~options]\n       (html {:mode :xml}\n         (xml-declaration (options# :encoding \"UTF-8\"))\n         ~(doctype :xhtml-strict)\n         (xhtml-tag (options# :lang) ~@contents)))))\n\n(defmacro html5\n  \"Create a HTML5 document with the supplied contents.\"\n  [options & contents]\n  (if-not (map? options)\n    `(html5 {} ~options ~@contents)\n    (if (options :xml?)\n      `(let [options# (dissoc ~options :xml?)]\n         (html {:mode :xml}\n           (xml-declaration (options# :encoding \"UTF-8\"))\n           ~(doctype :html5)\n           (xhtml-tag options# (options# :lang) ~@contents)))\n      `(let [options# (dissoc ~options :xml?)]\n         (html {:mode :html}\n           ~(doctype :html5)\n           [:html options# ~@contents])))))\n\n\n(defn- unevaluated?\n  \"True if the expression has not been evaluated.\"\n  [expr]\n  (or (symbol? expr)\n      (and (seq? expr)\n           (not= (first expr) `quote))))\n\n(defn- compile-attr-map\n  \"Returns an unevaluated form that will render the supplied map as HTML\n   attributes.\"\n  [attrs]\n  (if (some unevaluated? (mapcat identity attrs))\n    `(hiccups.runtime/render-attr-map ~attrs)\n    (rt/render-attr-map attrs)))\n\n(defn- form-name\n  \"Get the name of the supplied form.\"\n  [form]\n  (if (and (seq? form) (symbol? (first form)))\n    (name (first form))))\n\n(defmulti compile-form\n  \"Pre-compile certain standard forms, where possible.\"\n  {:private true}\n  form-name)\n\n(defmethod compile-form \"for\"\n  [[_ bindings body]]\n  `(cljs.core/apply cljs.core/str (cljs.core/for ~bindings (html ~body))))\n\n(defmethod compile-form \"if\"\n  [[_ condition & body]]\n `(if ~condition ~@(for [x body] `(html ~x))))\n\n(defmethod compile-form :default\n  [expr]\n  `(hiccups.runtime/render-html ~expr))\n\n(defn- literal?\n  \"True if x is a literal value that can be rendered as-is.\"\n  [x]\n  (and (not (unevaluated? x))\n       (or (not (or (vector? x) (map? x)))\n           (every? literal? x))))\n\n(defn- not-implicit-map?\n  \"True if we can infer that x is not a map.\"\n  [x]\n  (or (= (form-name x) \"for\")\n      (not (unevaluated? x))))\n\n(defn- element-compile-strategy\n  \"Returns the compilation strategy to use for a given element.\"\n  [[tag attrs & content :as element]]\n  (cond\n    (every? literal? element)\n      ::all-literal                    ; e.g. [:span \"foo\"]\n    (and (literal? tag) (map? attrs))\n      ::literal-tag-and-attributes     ; e.g. [:span {} x]\n    (and (literal? tag) (not-implicit-map? attrs))\n      ::literal-tag-and-no-attributes  ; e.g. [:span ^String x]\n    (literal? tag)\n      ::literal-tag                    ; e.g. [:span x]\n    :else\n      ::default))                      ; e.g. [x]\n\n(declare compile-html)\n\n(defmulti compile-element\n  \"Returns an unevaluated form that will render the supplied vector as a HTML\n   element.\"\n  {:private true}\n  element-compile-strategy)\n\n(defmethod compile-element ::all-literal\n  [element]\n  (rt/render-element (eval element)))\n\n(defmethod compile-element ::literal-tag-and-attributes\n  [[tag attrs & content]]\n  (let [[tag attrs _] (rt/normalize-element [tag attrs])]\n    (if (or content (rt/container-tags tag))\n      `(cljs.core/str ~(str \"<\" tag) ~(compile-attr-map attrs) \">\"\n                      ~@(compile-html content)\n                      ~(str \"</\" tag \">\"))\n      `(cljs.core/str \"<\" ~tag ~(compile-attr-map attrs) ~(rt/end-tag)))))\n\n(defmethod compile-element ::literal-tag-and-no-attributes\n  [[tag & content]]\n  (compile-element (apply vector tag {} content)))\n\n\n(defmethod compile-element ::literal-tag\n  [[tag attrs & content]]\n  (let [[tag tag-attrs _] (rt/normalize-element [tag])\n        attrs-sym         (gensym \"attrs\")]\n   `(let [~attrs-sym ~attrs]\n      (if (map? ~attrs-sym)\n         ~(if (or content (rt/container-tags tag))\n            `(cljs.core/str ~(str \"<\" tag)\n                            (hiccups.runtime/render-attr-map (merge ~tag-attrs ~attrs-sym)) \">\"\n                            ~@(compile-html content)\n                            ~(str \"</\" tag \">\"))\n            `(cljs.core/str ~(str \"<\" tag)\n                            (hiccups.runtime/render-attr-map (merge ~tag-attrs ~attrs-sym))\n                            ~(rt/end-tag)))\n         ~(if (or attrs (rt/container-tags tag))\n           `(cljs.core/str ~(str \"<\" tag (rt/render-attr-map tag-attrs) \">\")\n                           ~@(compile-html (cons attrs-sym content))\n                           ~(str \"</\" tag \">\"))\n           (str \"<\" tag (rt/render-attr-map tag-attrs) (rt/end-tag)))))))\n\n(defmethod compile-element :default\n  [element]\n  `(hiccups.runtime/render-element\n     [~(first element)\n      ~@(for [x (rest element)]\n          (if (vector? x)\n            (compile-element x)\n            x))]))\n\n(defn- compile-html\n  \"Pre-compile data structures into HTML where possible\"\n  [content]\n  (doall (for [expr content]\n           (cond\n             (vector? expr) (compile-element expr)\n             (literal? expr) expr\n             (seq? expr) (compile-form expr)\n             :else `(hiccups.runtime/render-html ~expr)))))\n\n\n(defn- collapse-strs\n  \"Collapse nested str expressions into one, where possible.\"\n  [expr]\n  (if (seq? expr)\n    (cons\n      (first expr)\n      (mapcat\n        #(if (and (seq? %) (symbol? (first %)) (= (first %) (first expr) `cljs.core/str))\n            (rest (collapse-strs %))\n            (list (collapse-strs %)))\n        (rest expr)))\n    expr))\n\n(defmacro html\n  \"Render Clojure data structures to a string of HTML.\"\n  [options & content]\n  (letfn [(make-html [content]\n            (collapse-strs `(cljs.core/str ~@(compile-html content))))]\n    (if-let [mode (and (map? options) (:mode options))]\n      (binding [rt/*html-mode* mode]\n        `(hiccups.runtime/in-mode ~mode\n           (fn [] ~(make-html content))))\n      (make-html (cons options content)))))\n\n(defmacro defhtml\n  \"Define a function, but wrap its output in an implicit html macro.\"\n  [name & fdecl]\n  (let [[fhead fbody] (split-with #(not (or (list? %) (vector? %))) fdecl)\n        wrap-html (fn [[args & body]] `(~args (html ~@body)))]\n    `(defn ~name\n       ~@fhead\n       ~@(if (vector? (first fbody))\n           (wrap-html fbody)\n           (map wrap-html fbody)))))\n\n"
  },
  {
    "path": "src/clj/hiccups/runtime.clj",
    "content": "(ns hiccups.runtime\n  (:require [clojure.string :as cstring]\n            [clojure.java.io :as io]))\n\n(defn- read-all [rdr]\n  (loop [forms []]\n    (let [f (read rdr false :eof)]\n      (if (= :eof f)\n          forms\n          (recur (conj forms f))))))\n          \n; Read contents from the runtime .cljs file\n; (a workaround for not being able to require a file with .cljs extensions in Clojure).\n(with-open [rt  (-> \"hiccups/runtime.cljs\" io/resource io/reader (java.io.PushbackReader.))]\n  (->> (rest (read-all rt))\n       (map eval)\n       dorun))\n\n"
  },
  {
    "path": "src/cljs/hiccups/runtime.cljs",
    "content": "(ns hiccups.runtime\n  (:require [clojure.string :as cstring]))\n\n(def ^{:doc \"Regular expression that parses a CSS-style id and class from a tag name.\" :private true}\n  re-tag #\"([^\\s\\.#]+)(?:#([^\\s\\.#]+))?(?:\\.([^\\s#]+))?\")\n\n(def ^{:doc \"Characters to replace when escaping HTML\" :private true}\n  character-escapes {\\& \"&amp;\", \\< \"&lt;\", \\> \"&gt;\", \\\" \"&quot;\"})\n\n(def ^{:doc \"A list of tags that need an explicit ending tag when rendered.\"}\n  container-tags\n  #{\"a\" \"b\" \"body\" \"canvas\" \"dd\" \"div\" \"dl\" \"dt\" \"em\" \"fieldset\" \"form\" \"h1\" \"h2\" \"h3\"\n    \"h4\" \"h5\" \"h6\" \"head\" \"html\" \"i\" \"iframe\" \"label\" \"li\" \"ol\" \"option\" \"pre\"\n    \"script\" \"span\" \"strong\" \"style\" \"table\" \"textarea\" \"ul\"})\n\n(defn as-str [x]\n  (if (or (keyword? x) (symbol? x))\n    (name x)\n    (str x)))\n\n(def ^:dynamic *html-mode* :xml)\n\n(defn- xml-mode? []\n  (= *html-mode* :xml))\n\n(defn in-mode [mode f]\n  (binding [*html-mode* mode]\n    (f)))\n\n(defn escape-html\n  \"Change special characters into HTML character entities.\"\n  [text]\n  (-> (as-str text)\n      (cstring/escape character-escapes)))\n\n(def h escape-html) ; alias for escape-html\n\n(defn end-tag []\n  (if (xml-mode?) \" />\" \">\"))\n\n(defn xml-attribute\n  ([name value] (xml-attribute name value true))\n  ([name value escape?]\n   (str \" \" (as-str name) \"=\\\"\" (if escape? (escape-html value) value) \"\\\"\")))\n\n(declare render-attr-map)\n\n(defn render-attribute [[name value]]\n  (cond\n    (true? value)\n      (if (xml-mode?)\n          (xml-attribute name name)\n          (str \" \" (as-str name)))\n    (not value)\n      \"\"\n    :else\n      (xml-attribute name (if (map? value) (render-attr-map value) value) false)))\n\n(defn render-attr-map [attrs]\n  (apply str\n    (sort (map render-attribute attrs))))\n\n(defn normalize-element\n  \"Ensure a tag vector is of the form [tag-name attrs content].\"\n  [[tag & content]]\n  (when (not (or (keyword? tag) (symbol? tag) (string? tag)))\n    (throw (str tag \" is not a valid tag name\")))\n  (let [[_ tag id class] (re-matches re-tag (as-str tag))\n        tag-attrs        {:id id\n                          :class (if class (cstring/replace class \".\" \" \"))}\n        map-attrs        (first content)]\n    (if (map? map-attrs)\n      [tag (merge tag-attrs map-attrs) (next content)]\n      [tag tag-attrs content])))\n\n(declare render-html)\n\n(defn render-element\n  \"Render a tag vector as a HTML element.\"\n  [element]\n  (let [[tag attrs content] (normalize-element element)]\n    (if (or content (container-tags tag))\n      (str \"<\" tag (render-attr-map attrs) \">\"\n           (render-html content)\n           \"</\" tag \">\")\n      (str \"<\" tag (render-attr-map attrs) (end-tag)))))\n\n(defn render-html\n  \"Turn a Clojure data type into a string of HTML.\"\n  [x]\n  (cond\n    (vector? x) (render-element x)\n    (seq? x) (apply str (map render-html x))\n    :else (as-str x)))\n"
  },
  {
    "path": "test/cljs/hiccups/core_test.cljs",
    "content": ";;; This namespace is used for testing purpose. It use the\n;;; clojurescript.test lib.\n(ns hiccups.core-test\n  (:require-macros [cemerick.cljs.test :as m :refer (deftest is)]\n                   [hiccups.core :as hiccups])\n  (:require [cemerick.cljs.test :as t]\n            [hiccups.runtime :as hiccupsrt]))\n\n(deftest runtime-escaped-chars\n  (is (= (hiccupsrt/escape-html \"\\\"\") \"&quot;\"))\n  (is (= (hiccupsrt/escape-html \"<\") \"&lt;\"))\n  (is (= (hiccupsrt/escape-html \">\") \"&gt;\"))\n  (is (= (hiccupsrt/escape-html \"&\") \"&amp;\"))\n  (is (= (hiccupsrt/escape-html \"foo\") \"foo\")))\n\n(deftest tag-names\n  (is (= (hiccups/html [:div]) \"<div></div>\"))\n  (is (= (hiccups/html [\"div\"]) \"<div></div>\"))\n  (is (= (hiccups/html ['div]) \"<div></div>\"))\n  (is (= (hiccups/html [:div#foo]) \"<div id=\\\"foo\\\"></div>\"))\n  (is (= (hiccups/html [:form#sign-in]) \"<form id=\\\"sign-in\\\"></form>\"))\n  (is (= (hiccups/html [:input#sign-in-email]) \"<input id=\\\"sign-in-email\\\" />\"))\n  (is (= (hiccups/html [:div.foo]) \"<div class=\\\"foo\\\"></div>\"))\n  (is (= (hiccups/html [:div.foo (str \"bar\" \"baz\")])\n           \"<div class=\\\"foo\\\">barbaz</div>\"))\n  (is (= (hiccups/html [:div.a.b]) \"<div class=\\\"a b\\\"></div>\"))\n  (is (= (hiccups/html [:div.a.b.c]) \"<div class=\\\"a b c\\\"></div>\"))\n  (is (= (hiccups/html [:div#foo.bar.baz])\n           \"<div class=\\\"bar baz\\\" id=\\\"foo\\\"></div>\")))\n\n(deftest tag-contents\n ; empty tags\n (is (= (hiccups/html [:div]) \"<div></div>\"))\n (is (= (hiccups/html [:h1]) \"<h1></h1>\"))\n (is (= (hiccups/html [:script]) \"<script></script>\"))\n (is (= (hiccups/html [:text]) \"<text />\"))\n (is (= (hiccups/html [:a]) \"<a></a>\"))\n (is (= (hiccups/html [:iframe]) \"<iframe></iframe>\"))\n ; tags containing text\n (is (= (hiccups/html [:text \"Lorem Ipsum\"]) \"<text>Lorem Ipsum</text>\"))\n ; contents are concatenated\n (is (= (hiccups/html [:body \"foo\" \"bar\"]) \"<body>foobar</body>\"))\n (is (= (hiccups/html [:body [:p] [:br]]) \"<body><p /><br /></body>\"))\n ; seqs are expanded\n (is (= (hiccups/html [:body (list \"foo\" \"bar\")]) \"<body>foobar</body>\"))\n (is (= (hiccups/html (list [:p \"a\"] [:p \"b\"])) \"<p>a</p><p>b</p>\"))\n ; tags can contain tags\n (is (= (hiccups/html [:div [:p]]) \"<div><p /></div>\"))\n (is (= (hiccups/html [:div [:b]]) \"<div><b></b></div>\"))\n (is (= (hiccups/html [:p [:span [:a \"foo\"]]])\n          \"<p><span><a>foo</a></span></p>\")))\n\n(deftest tag-attributes\n  ; tag with blank attribute map\n  (is (= (hiccups/html [:xml {}]) \"<xml />\"))\n  ; tag with populated attribute map\n  (is (= (hiccups/html [:xml {:a \"1\", :b \"2\"}]) \"<xml a=\\\"1\\\" b=\\\"2\\\" />\"))\n  (is (= (hiccups/html [:img {\"id\" \"foo\"}]) \"<img id=\\\"foo\\\" />\"))\n  (is (= (hiccups/html [:img {'id \"foo\"}]) \"<img id=\\\"foo\\\" />\"))\n  (is (= (hiccups/html [:xml {:a \"1\", 'b \"2\", \"c\" \"3\"}])\n           \"<xml a=\\\"1\\\" b=\\\"2\\\" c=\\\"3\\\" />\"))\n  ; attribute values are escaped\n  (is (= (hiccups/html [:div {:id \"\\\"\"}]) \"<div id=\\\"&quot;\\\"></div>\"))\n  ; boolean attributes\n  (is (= (hiccups/html [:input {:type \"checkbox\" :checked true}])\n           \"<input checked=\\\"checked\\\" type=\\\"checkbox\\\" />\"))\n  (is (= (hiccups/html [:input {:type \"checkbox\" :checked false}])\n           \"<input type=\\\"checkbox\\\" />\"))\n  ; nil attributes\n  (is (= (hiccups/html [:span {:class nil} \"foo\"])\n           \"<span>foo</span>\")))\n\n(deftest compiled-tags\n  ; tag content can be vars\n  (is (= (let [x \"foo\"] (hiccups/html [:span x])) \"<span>foo</span>\"))\n  ; tag content can be forms\n  (is (= (hiccups/html [:span (str (+ 1 1))]) \"<span>2</span>\"))\n  (is (= (hiccups/html [:span ({:foo \"bar\"} :foo)]) \"<span>bar</span>\"))\n  ; attributes can contain vars\n  (let [x \"foo\"]\n    (is (= (hiccups/html [:xml {:x x}]) \"<xml x=\\\"foo\\\" />\"))\n    (is (= (hiccups/html [:xml {x \"x\"}]) \"<xml foo=\\\"x\\\" />\"))\n    (is (= (hiccups/html [:xml {:x x} \"bar\"]) \"<xml x=\\\"foo\\\">bar</xml>\")))\n  ; attributes are evaluated\n    (is (= (hiccups/html [:img {:src (str \"/foo\" \"/bar\")}])\n             \"<img src=\\\"/foo/bar\\\" />\"))\n    (is (= (hiccups/html [:div {:id (str \"a\" \"b\")} (str \"foo\")])\n             \"<div id=\\\"ab\\\">foo</div>\"))\n  ; optimized forms\n    (is (= (hiccups/html [:ul (for [n (range 3)]\n                                  [:li n])])\n             \"<ul><li>0</li><li>1</li><li>2</li></ul>\"))\n    (is (= (hiccups/html [:div (if true\n                                   [:span \"foo\"]\n                                   [:span \"bar\"])])\n             \"<div><span>foo</span></div>\"))\n  ; values are evaluated only once\n  (let [times-called (atom 0)\n        foo #(do (swap! times-called inc) \"foo\")]\n    (hiccups/html [:div (foo)])\n    (is (= 1 @times-called))))\n\n(deftest defhtml-macro\n  ; basic html function\n  (hiccups/defhtml basic-fn [x] [:span x])\n  (is (= (basic-fn \"foo\") \"<span>foo</span>\"))\n  ; html function with overloads\n  (hiccups/defhtml overloaded-fn\n    ([x] [:span x])\n    ([x y] [:span x [:div y]]))\n  (is (= (overloaded-fn \"foo\") \"<span>foo</span>\"))\n  (is (= (overloaded-fn \"foo\" \"bar\")\n           \"<span>foo<div>bar</div></span>\")))\n\n(deftest render-modes\n  ; \"closed tag\"\n  (is (= (hiccups/html [:br]) \"<br />\"))\n  (is (= (hiccups/html {:mode :xml} [:br]) \"<br />\"))\n  (is (= (hiccups/html {:mode :sgml} [:br]) \"<br>\"))\n  (is (= (hiccups/html {:mode :html} [:br]) \"<br>\"))\n  ; boolean attributes\n  (is (= (hiccups/html {:mode :xml} [:input {:type \"checkbox\" :checked true}])\n           \"<input checked=\\\"checked\\\" type=\\\"checkbox\\\" />\"))\n  (is (= (hiccups/html {:mode :sgml} [:input {:type \"checkbox\" :checked true}])\n           \"<input checked type=\\\"checkbox\\\">\"))\n  ; \"laziness and binding scope\"\n  (is (= (hiccups/html {:mode :sgml} [:html [:link] (list [:link])])\n           \"<html><link><link></html>\")))\n"
  }
]