Skip to content

Commit

Permalink
Use more qualified ns: com.github.ragnard.hamelito
Browse files Browse the repository at this point in the history
  • Loading branch information
ragnard committed Feb 22, 2013
1 parent a7d4db8 commit 317e125
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject hamelito "0.1.0-SNAPSHOT"
(defproject com.github.ragnard/hamelito "0.1.0-SNAPSHOT"
:description "Library for a subset of Haml with hiccup and enlive support"
:url "http://github.com/ragnard/hamelito"
:license {:name "Eclipse Public License"
Expand Down
@@ -1,4 +1,4 @@
(ns hamelito.doctypes)
(ns com.github.ragnard.hamelito.doctypes)

(def ^:private doctypes
{:xhtml
Expand Down
@@ -1,12 +1,19 @@
(ns hamelito.enlive
(:require [hamelito.doctypes :as doctypes]
[hamelito.parser :as parser]
(ns com.github.ragnard.hamelito.enlive
(:require [com.github.ragnard.hamelito.doctypes :as doctypes]
[com.github.ragnard.hamelito.parser :as parser]
[clojure.string :as string]
[clojure.java.io :as io]))
[clojure.java.io :as io])
(:import [com.github.ragnard.hamelito.parser
Comment
Document
Doctype
Element
Text
FilteredBlock]))

;; bring in the cond->
(when (< (:minor *clojure-version*) 5)
(use 'hamelito.util))
(use 'com.github.ragnard.hamelito.util))

(def vec-conj (fnil conj []))

Expand Down Expand Up @@ -72,23 +79,23 @@


(extend-protocol ToEnliveNode
hamelito.parser.Element
Element
(-enlive-node [this] (element->enlive-node this))

hamelito.parser.Text
Text
(-enlive-node [this] (:text this))

hamelito.parser.Comment
Comment
(-enlive-node [this] (comment->enlive-node this))

hamelito.parser.FilteredBlock
FilteredBlock
(-enlive-node [this] (filtered-block->enlive-node this))


hamelito.parser.Doctype
Doctype
(-enlive-node [this] (doctypes/lookup-doctype :html5 (:value this)))

hamelito.parser.Document
Document
(-enlive-node [this]
(concat (map -enlive-node (:doctypes this))
(map -enlive-node (:elements this)))))
Expand Down
@@ -1,12 +1,19 @@
(ns hamelito.hiccup
(:require [hamelito.doctypes :as doctypes]
[hamelito.parser :as parser]
(ns com.github.ragnard.hamelito.hiccup
(:require [com.github.ragnard.hamelito.doctypes :as doctypes]
[com.github.ragnard.hamelito.parser :as parser]
[hiccup.core :as hiccup]
[clojure.string :as string]))
[clojure.string :as string])
(:import [com.github.ragnard.hamelito.parser
Comment
Document
Doctype
Element
Text
FilteredBlock]))

;; bring in the cond->
(when (< (:minor *clojure-version*) 5)
(use 'hamelito.util))
(use 'com.github.ragnard.hamelito.util))

(defn- flat-conj
[vec xs]
Expand Down Expand Up @@ -78,22 +85,22 @@
{:node filtered-block})))

(extend-protocol ToHiccup
hamelito.parser.Element
Element
(-to-hiccup [this] (element->hiccup this))

hamelito.parser.Text
Text
(-to-hiccup [this] (:text this))

hamelito.parser.FilteredBlock
FilteredBlock
(-to-hiccup [this] (filtered-block->hiccup this))

hamelito.parser.Comment
Comment
(-to-hiccup [this] (comment->hiccup this))

hamelito.parser.Doctype
Doctype
(-to-hiccup [this] (doctypes/lookup-doctype :html5 (:value this)))

hamelito.parser.Document
Document
(-to-hiccup [this] (concat
(mapv -to-hiccup (:doctypes this))
(mapv -to-hiccup (:elements this)))))
Expand Down
@@ -1,4 +1,4 @@
(ns hamelito.parser
(ns com.github.ragnard.hamelito.parser
(:refer-clojure :exclude [class])
(:require [clojure.string :as string])
(:use [blancas.kern.core :exclude [char-seq]]))
Expand Down
@@ -1,4 +1,4 @@
(ns hamelito.util)
(ns com.github.ragnard.hamelito.util)

(defmacro cond->
"Conditional threading macro. Takes an initial value and an even
Expand Down
@@ -1,8 +1,8 @@
(ns hamelito.haml-spec-test
(ns com.github.ragnard.hamelito.haml-spec-test
(:require [cheshire.core :as json]
[clojure.string :as string]
[clojure.java.io :as io]
[hamelito.parser :as parser])
[com.github.ragnard.hamelito.parser :as parser])
(:use [clojure.test :only [deftest is testing]]))

(def haml-spec (json/parse-stream
Expand Down
@@ -1,5 +1,5 @@
(ns hamelito.hiccup-test
(:require [hamelito.hiccup :as hiccup])
(ns com.github.ragnard.hamelito.hiccup-test
(:require [com.github.ragnard.hamelito.hiccup :as hiccup])
(:use [clojure.test]))

(defmacro defhtmltest
Expand Down

0 comments on commit 317e125

Please sign in to comment.