Skip to content

Commit

Permalink
Temporarily no XHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
stain committed Sep 30, 2014
1 parent 75de374 commit faf1f42
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/owlview/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
[compojure.core :refer [defroutes ANY]]))

(defn xhtml? [ctx]
; (= "application/xhtml+xml";
; (print
; (get-in ctx [:representation :media-type]))
false)
(= "application/xhtml+xml";
(get-in ctx [:representation :media-type])))

; Map from uri to owl-managers
;(defonce known-ontologies (atom {}))
Expand Down Expand Up @@ -53,8 +51,7 @@
(load-ontology uri)))

(defn html [ctx title & body]
(html5 {:xml? (xhtml? ctx)}
[:head
(html5 {:xml? false} [:head
[:title (escape-html title)]
(include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css"
"//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.css"
Expand Down Expand Up @@ -133,6 +130,7 @@
[:a {:href iri} iri]
)
(instance? OWLLiteral v)
; TODO: Check first character for <html tags? :)
(md-to-html-string (.getLiteral v) :heading-anchors true)
:else (escape-html v)))

Expand Down Expand Up @@ -169,7 +167,8 @@

(defroutes app
(ANY "/" [] (resource
:available-media-types ["text/html" "application/xhtml+xml"]
;:available-media-types ["text/html" "application/xhtml+xml"]
:available-media-types ["text/html"]
:handle-ok (fn [ctx] (html ctx "owlview"
[:div {:class "jumbotron"}
"Visualize an OWL/RDFS ontology:"
Expand All @@ -184,7 +183,8 @@
]
))))
(ANY "/ont" [] (resource
:available-media-types ["text/html" "application/xhtml+xml"]
;':available-media-types ["text/html" "application/xhtml+xml"]
:available-media-types ["text/html"]
:allowed-methods [:post :get]
:handle-exception (fn [{err :exception :as ctx}]
(print-stack-trace err)
Expand Down Expand Up @@ -230,7 +230,8 @@
))

(ANY "/ont/*" [& {url :* }] (resource
:available-media-types ["text/html" "application/xhtml+xml"]
;:available-media-types ["text/html" "application/xhtml+xml"]
:available-media-types ["text/html"]
:handle-exception (fn [{err :exception :as ctx}]
(print-stack-trace err)
(forget-owl-manager-for url) ; force reload and unlisting
Expand Down

0 comments on commit faf1f42

Please sign in to comment.