Permalink
Browse files

remove hic2htmls

  • Loading branch information...
1 parent 85b4954 commit 15d50fbdafff2bc4ae54e6517f07f8130d0d3541 Takahiro Hozumi committed Jul 6, 2012
Showing with 6 additions and 35 deletions.
  1. +0 −7 README.md
  2. +6 −28 src/leiningen/hicv.clj
View
@@ -41,13 +41,6 @@ The functions which include hiccup vector are gathered from source files and con
-rw-r--r-- 1 fatrow staff 895 10 30 00:37 your.app.namespace.view2.html
Files are created at each namespace file.
-If you want to separate file, use **2htmls**
-
- % lein hicv 2htmls
- % ls -l hicv
- -rw-r--r-- 1 fatrow staff 434 10 30 00:37 your.app.namespace.view1.render-sidebar.html
- -rw-r--r-- 1 fatrow staff 895 10 30 00:37 your.app.namespace.view1.render-page.html
- -rw-r--r-- 1 fatrow staff 895 10 30 00:37 your.app.namespace.view2.render-my-page.html
### Html to hiccup function
View
@@ -181,13 +181,6 @@
replaced
".html")))
-(defn- get-name [exp]
- (let [expanded (macroexpand exp)]
- (pat/match expanded
- v :when (not (coll? v)) nil
- [fs x & _] :when (= fs 'def) x
- _ nil)))
-
(defn- path2ns [path src-path]
(let [src-path (if (= \/ (last src-path))
src-path
@@ -204,40 +197,27 @@
[(path2ns file-path src-path)
(filter identity
(for [exp (list-s file-path)]
- (if-let [n (and (should-be-child? exp) (get-name exp))]
- [n exp])))])))
+ (when (should-be-child? exp)
+ exp)))])))
(defn- mk-syms [nspace hic-names]
(map #(symbol (str nspace "/" %)) hic-names))
-(defn- hic2html [src-path targets]
+(defn- hic2html [src-path]
(prepare-hicv-dir!)
- (doseq [[nspace name&exps] (search-hic src-path)]
+ (doseq [[nspace exps] (search-hic src-path)]
(do (with-open [f (-> nspace ns2filename io/writer)]
(doto f
(.write "<hicv />")
(.newLine)
(.newLine)))
(with-open [f (-> nspace ns2filename (io/writer ,,, :append true))]
- (doseq [[_ exp] name&exps]
+ (doseq [exp exps]
(doto f
(.write (-> exp hic2vec hic/html))
(.newLine)
(.newLine)))))))
-(defn- hic2htmls [src-path targets]
- (prepare-hicv-dir!)
- (doseq [[nspace name&exps] (search-hic src-path)
- [nam exp] name&exps]
- (with-open [f (-> (str nspace "." (name nam)) ns2filename io/writer)]
- (doto f
- (.write "<hicv />")
- (.newLine)
- (.newLine)
- (.write (hic/html (hic2vec exp)))
- (.newLine)
- (.newLine)))))
-
(defn- html2hic [resource]
(let [encoding (enc/detect resource :default)
nodes (-> resource
@@ -258,10 +238,8 @@
(defn hicv
[project & [first-arg & rest-args]]
(condp = first-arg
- "2html" (hic2html (:source-path project) (:target-hiccup project))
- "2htmls" (hic2htmls (:source-path project) (:target-hiccup project))
+ "2html" (hic2html (:source-path project))
"2hic" (html2hic-front rest-args)
(println "Usage:
lein hicv 2html
- lein hicv 2htmls
lein hicv 2hic\n")))

0 comments on commit 15d50fb

Please sign in to comment.