1. Ning Sun
  2. osm-api-tests

Commits

Ning Sun  committed ebccee9

add hiccup to generate html

  • Participants
  • Parent commits ac3c1ac
  • Branches default

Comments (0)

Files changed (2)

File project.clj

View file
   :dependencies [[org.clojure/clojure "1.2.0"]
                  [org.clojure/clojure-contrib "1.2.0"]
                  [compojure "0.6.0-RC3"]
-                 [ring/ring-jetty-adapter "0.3.5"]]
+                 [ring/ring-jetty-adapter "0.3.5"]
+                 [hiccup "0.3.4"]]
   :main osm-api.web)

File src/osm_api/web.clj

View file
     (:gen-class)
     (:use [osm-api.core :exclude [-main]])
     (:use compojure.core, ring.adapter.jetty, compojure.handler)
+    (:use hiccup.core)
     (:use [clojure.string :only [split,join]]))
     
 (defn ways [bbox-str]
         (parse-osm-xml(apply load-from-osm (split bbox-str #","))))))        
 
 (defn to-link [url]
-    (str "<a href=\"" url "\">" url "</a>"))        
+    (html [:a {:href url} url]))        
         
 (defroutes root
     (GET "/ways" {{bbox :bbox} :params}