Browse Source

switched to PegDown directly

master
Christian Mueller 12 years ago
parent
commit
b47c013b28
  1. 2
      project.clj
  2. 1
      resources/public/styles/main.less
  3. 3
      src/notehub/handler.clj
  4. 16
      src/notehub/views.clj

2
project.clj

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
[org.clojure/core.cache "0.6.3"]
[hiccup "1.0.0"]
[zeus "0.1.0"]
[me.raynes/cegdown "0.1.1"]
[org.pegdown/pegdown "1.4.2"]
[iokv "0.1.1"]
[cheshire "5.3.1"]
[ring/ring-core "1.2.0"]

1
resources/public/styles/main.less

@ -170,6 +170,7 @@ h1, h2, h3, h4, h5, h6 { @@ -170,6 +170,7 @@ h1, h2, h3, h4, h5, h6 {
font-family: @header_font,'Noticia Text','PT Serif','Georgia';
}
table {
width: 100%;
border-collapse: collapse;
}
th {

3
src/notehub/handler.clj

@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
[clojure.string :rename {replace sreplace} :only [replace]]
[clojure.core.incubator :only [-?>]])
(:require
[me.raynes.cegdown :as md]
[clojure.core.cache :as cache]
[hiccup.util :as util]
[compojure.handler :as handler]
@ -49,7 +48,7 @@ @@ -49,7 +48,7 @@
(defroutes app-routes
(GET "/api" [] (layout :no-js (get-message :api-title)
[:article (md/to-html (slurp "API.md"))]))
[:article (md-to-html (slurp "API.md"))]))
(context "/api" []
#(ring.util.response/content-type (api-routes %) "application/json"))

16
src/notehub/views.clj

@ -9,11 +9,17 @@ @@ -9,11 +9,17 @@
[hiccup.util :only [escape-html]]
[hiccup.page :only [include-js html5]])
(:require
[me.raynes.cegdown :as md]
[notehub.api :as api]))
[notehub.api :as api])
(:import (org.pegdown PegDownProcessor Extensions)))
(def get-message (get-map "messages"))
(def md-processor
(PegDownProcessor. Extensions/TABLES))
(defn md-to-html [md-text]
(.markdownToHtml md-processor md-text))
; Creates the main html layout
(defn layout
[js? title & content]
@ -69,8 +75,8 @@ @@ -69,8 +75,8 @@
[:div#dashed-line]
[:article.helvetica.bottom-space
{:style "font-size: 1em"}
(md/to-html (slurp "LANDING.md"))]
[:div.centered.helvetica (md/to-html (get-message :footer))]))
(md-to-html (slurp "LANDING.md"))]
[:div.centered.helvetica (md-to-html (get-message :footer))]))
(defn statistics-page [resp]
@ -104,7 +110,7 @@ @@ -104,7 +110,7 @@
(let [note (api/get-note {:noteID note-id})
sanitized-note (sanitize (:note note))]
(layout :no-js (:title note)
[:article.bottom-space (md/to-html sanitized-note)]
[:article.bottom-space (md-to-html sanitized-note)]
(let [urls {:short-url (api/url short-url)
:notehub "/"}
links (map #(link-to

Loading…
Cancel
Save