diff options
author | rmckenzie <rmckenzie92@gmail.com> | 2013-03-13 10:37:12 -0500 |
---|---|---|
committer | rmckenzie <rmckenzie92@gmail.com> | 2013-03-13 10:37:12 -0500 |
commit | 673969fb98f9ecd91023d9557dee5eb31cc9bcee (patch) | |
tree | 0f47b89da8e1e59f817f34d7d3ed15ffacb32c37 | |
parent | fa967c8b87dd8a850b6fe4ae74f3ab7a07c95177 (diff) |
done fing with that now
-rw-r--r-- | README.md | 46 |
1 files changed, 27 insertions, 19 deletions
@@ -6,33 +6,30 @@ developed for refactoring raw or static html easily into the Ring web development stack. The Hiccup formatting language allows the description of HTML syntax trees in -a Lisp-like prefix notation based on Clojure's Vector literal denoted ```clojure[]```. In -Hiccup one may say ```clojure [:a {:class "bar" :href "/"} "go home!"" ]```, which renders +a Lisp-like prefix notation based on Clojure's Vector literal denoted `[]`. In +Hiccup one may say `[:a {:class "bar" :href "/"} "go home!"" ]`, which renders to the equivalent html `<a href="/" class="bar"> go home! </a>`. As you can see this is a fairly regular translation and the Hiccup tool makes it easy to go from Clojure to HTML. Decomp decomposes the expanded html into the Huccup-equivalent vector stack, completing the round trip. -## Get Decomp - - - -## Example +## Usage ```clojure > (use 'me.arrdem.decomp.core) ;; process-string wraps the application of the lexer, parser and pprinter in one easy function -> (process-string "<foo a=\"b\"> this - <!-- ignored --> - <a href=\"/bar\"> - goes home - </a> - as does - <a href=\"/\"> - this! - </a> - </foo>") +> (pprint (process-string + "<foo a=\"b\"> this + <!-- ignored --> + <a href=\"/bar\"> + goes home + </a> + as does + <a href=\"/\"> + this! + </a> + </foo>")) [[:foo {:a "b"} "this" @@ -44,11 +41,10 @@ nil ;; Decomp supports arbitrary properties and tags... > (process-string "<baz bung=\"1\" blarrrrrrrrgh=\"2\"> </baz>") [[:baz {:blarrrrrrrrgh "2", :bung "1"}]] -nil ``` Decomp can also be used as a standalone tool able to translate files or standard input from html -to hiccup. The standalone jar can be invoked as ```shell $ java -jar decomp.jar foo.html``` just +to hiccup. The standalone jar can be invoked as `$ java -jar decomp.jar foo.html` just as one would expect. Multiple file arguments are supported, and in the absence of file arguments decomp will attempt to read & process HTML from standard input. @@ -60,6 +56,18 @@ decomp will attempt to read & process HTML from standard input. - Javascript (due to semicolons and {}) will likely break the parser or at least behave strangely - Inline CSS should work but is iffy + +## Get Decomp + +### Leiningen: +```Clojure +[me.arrdem.decomp "0.1.1"] +``` + +### Standalone: +[Standalone Jar](https://raw.github.com/arrdem/decomp/master/decomp.jar) + + ## License Copyright © 2013 Reid "arrdem" McKenzie |