From e05e93784bef527c4b49399347f0018c0591839e Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Mon, 28 May 2012 00:19:42 +0200 Subject: [PATCH] switched to pegdown plugin --- project.clj | 2 +- src/NoteHub/views/common.clj | 25 +++++++++++++++---------- src/NoteHub/views/pages.clj | 6 +++--- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/project.clj b/project.clj index 4c878d1..496ea76 100644 --- a/project.clj +++ b/project.clj @@ -3,7 +3,7 @@ :dependencies [[org.clojure/clojure "1.4.0"] [hiccup "1.0.0"] [cssgen "0.2.6"] - [markdown-clj "0.8"] + [org.pegdown/pegdown "1.1.0"] [noir "1.3.0-beta1"]] :plugins [[lein-cljsbuild "0.1.10"]] :cljsbuild { diff --git a/src/NoteHub/views/common.clj b/src/NoteHub/views/common.clj index 1f7ed76..eab6ff2 100644 --- a/src/NoteHub/views/common.clj +++ b/src/NoteHub/views/common.clj @@ -5,20 +5,20 @@ [hiccup.page :only [include-js html5]] [hiccup.element :only [javascript-tag]])) -(defn gen-comma-list [fonts] (apply str (interpose "," fonts))) +(defn gen-comma-list [& fonts] (apply str (interpose "," fonts))) +(def helvetica-neue + (mixin + :font-weight 300 + :font-family (gen-comma-list "'Helvetica Neue'" + "Helvetica" + "Arial" + "'Lucida Grande'" + "sans-serif"))) (def global-css (css (rule ".centerized" :text-align :center) - (def helvetica-neue - (mixin - :font-weight 300 - :font-family (gen-comma-list ["'Helvetica Neue'" - "Helvetica" - "Arial" - "'Lucida Grande'" - "sans-serif"]))) (rule ".button" :box-shadow [0 :2px :5px :#aaa] :text-decoration :none @@ -50,6 +50,7 @@ (rule "*:focus" :outline [:0px :none :transparent]) (rule "textarea" + :width "900px" :font-family :Courier :font-size :1.3em :border :none @@ -68,7 +69,11 @@ :margin-bottom :5em :margin-left "auto" :margin-right "auto") - (rule "h1, h2, h3, h4" :font-family "'Noticia Text'"))) + (rule "h1" + :font-size :2em) + (rule "h1, h2, h3, h4" + :font-family (gen-comma-list + "'Noticia Text'" "Georgia")))) (defpartial layout [title & content] (html5 diff --git a/src/NoteHub/views/pages.clj b/src/NoteHub/views/pages.clj index 1cf6591..ecce3a4 100644 --- a/src/NoteHub/views/pages.clj +++ b/src/NoteHub/views/pages.clj @@ -1,8 +1,8 @@ (ns NoteHub.views.pages (:require [NoteHub.views.common :as common]) (:use [noir.core :only [defpage]] - [hiccup.form] - [markdown :only [md-to-html-string]])) + [hiccup.form]) + (:import [org.pegdown PegDownProcessor])) (defpage "/" {} (common/layout "Free Markdown Hosting" @@ -25,4 +25,4 @@ (defpage [:post "/preview-note"] {:keys [draft]} (common/layout "Preview of ..." [:article.central-body - (md-to-html-string draft)])) + (.markdownToHtml (PegDownProcessor.) draft)]))