fonts can be changed now

This commit is contained in:
Christian Mueller
2012-06-07 00:54:43 +02:00
parent 7125155939
commit a8326cea93
3 changed files with 27 additions and 16 deletions
+9 -4
View File
@@ -10,12 +10,17 @@
(html5
[:head
[:title "NoteHub — " title]
[:link {:href (str "http://fonts.googleapis.com/css?family="
"PT+Serif:700|Noticia+Text:700"
"&subset=latin,cyrillic" )
[:link {:href
(clojure.string/replace
(str "http://fonts.googleapis.com/css?family="
(apply str
(interpose "|" (concat ["PT+Serif:700" "Noticia+Text:700"]
(vals (select-keys params
[:header-font :text-font])))))
"&subset=latin,cyrillic") " " "+")
:rel "stylesheet"
:type "text/css"}]
[:style {:type "text/css"} (global-css (params :theme))]]
[:style {:type "text/css"} (global-css params)]]
(if (params :js)
[:body content
(javascript-tag "var CLOSURE_NO_DEPS = true;")
+14 -7
View File
@@ -2,7 +2,11 @@
(:use [cssgen]
[cssgen.types]))
(defn gen-comma-list [& fonts] (apply str (interpose "," fonts)))
(defn gen-fontlist [& fonts]
(apply str
(interpose ","
(map #(str "'" % "'")
(filter identity fonts)))))
(def page-width
(mixin
@@ -10,10 +14,10 @@
(def helvetica-neue
(mixin
:font-weight 300
:font-family (gen-comma-list "'Helvetica Neue'"
:font-family (gen-fontlist "Helvetica Neue"
"Helvetica"
"Arial"
"'Lucida Grande'"
"Lucida Grande"
"sans-serif")))
(def central-element
(mixin
@@ -33,8 +37,11 @@
:background-halftone :#efefef
:foreground-halftone :#888 }} [theme tone]))
(defn global-css [arg]
(let [theme (if arg (keyword arg) :default)
(defn global-css [params]
(let [theme (params :theme)
theme (if theme (keyword theme) :default)
header-fonts (gen-fontlist (params :header-font) "Noticia Text" "PT Serif")
text-fonts (gen-fontlist (params :text-font) "Georgia")
background (color theme :background)
foreground (color theme :foreground)
background-halftone (color theme :background-halftone)
@@ -66,7 +73,7 @@
(rule "article"
central-element
:line-height (% 140)
:font-family :Georgia
:font-family text-fonts
:font-size :1.2em
(rule "& > h1:first-child"
:text-align :center
@@ -104,4 +111,4 @@
:border-bottom [:1px :dashed foreground-halftone]
:margin-bottom :5em)
(rule "h1, h2, h3, h4"
:font-family (gen-comma-list "'Noticia Text'" "'PT Serif'")))))
:font-family header-fonts))))
+4 -5
View File
@@ -79,11 +79,10 @@
(common/layout params title [:article (md-to-html md-text)]))
(status 404 (get-page 404))))
(defpage "/:year/:month/:day/:title/theme/:theme" {:keys [year month day title theme]}
(wrap {:theme theme} (get-note [year month day] title)))
(defpage "/:year/:month/:day/:title" {:keys [year month day title]}
(wrap {:theme :default} (get-note [year month day] title)))
(defpage "/:year/:month/:day/:title" {:keys [year month day title theme header-font text-font] :as params}
(wrap
(select-keys params [:theme :header-font :text-font])
(get-note [year month day] title)))
(defpage "/:year/:month/:day/:title/export" {:keys [year month day title]}
(let [md-text (get-note [year month day] title)]