From 58f61b5caaa7301582ea83d79c128101aed5282e Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Fri, 3 Jan 2014 23:47:07 +0100 Subject: [PATCH] bugfix: google web fonts enabled --- resources/public/style.less | 7 +++++-- src/NoteHub/views/common.clj | 19 +++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/resources/public/style.less b/resources/public/style.less index 9d17e01..e9ee3c0 100644 --- a/resources/public/style.less +++ b/resources/public/style.less @@ -10,6 +10,9 @@ @width: 800px; +@header_font: 'Noticia Text'; +@text_font: 'Georgia'; + // mixins .helvetica { font-weight: 300; @@ -109,7 +112,7 @@ html, body { article { .central-element; margin-top: 5em; - font-family: 'Georgia'; + font-family: @text_font, 'Georgia'; text-align: justify; font-size: 1.2em; } @@ -155,5 +158,5 @@ h1 { margin-bottom: 3em; } h1, h2, h3, h4, h5, h6 { - font-family: 'Noticia Text','PT Serif','Georgia'; + font-family: @header_font,'Noticia Text','PT Serif','Georgia'; } diff --git a/src/NoteHub/views/common.clj b/src/NoteHub/views/common.clj index 9f1e9f9..bc77ffb 100644 --- a/src/NoteHub/views/common.clj +++ b/src/NoteHub/views/common.clj @@ -19,7 +19,9 @@ [params title & content] ; for the sake of security: escape all symbols of the param values (let [params (into {} (for [[k v] params] [k (escape-html v)])) - theme (:theme params "default")] + theme (:theme params "default") + header-font (:header-font params) + text-font (:text-font params)] (html5 [:head [:title (print-str (get-message :name) "—" title)] @@ -28,14 +30,8 @@ [:link {:href (clojure.string/replace (str "http://fonts.googleapis.com/css?family=" - (apply - str - (interpose "|" - ; ugly thing, but it cannot be avoided since these - ; fonts have to be loaded (independently of CSS) - (concat ["PT+Serif:700" "Noticia+Text:700"] - (vals (select-keys params - [:header-font :text-font]))))) + (apply str + (interpose "|" ["PT+Serif:700" "Noticia+Text:700" header-font text-font])) "&subset=latin,cyrillic") " " "+") :rel "stylesheet" :type "text/css"}] @@ -53,7 +49,10 @@ '@foreground_halftone': themes['" theme "'].foreground.halftone, '@link_fresh': themes['" theme "'].link.fresh, '@link_visited': themes['" theme "'].link.visited, - '@link_hover': themes['" theme "'].link.hover});"))) + '@link_hover': themes['" theme "'].link.hover" + (when header-font (str ", '@header_font': '" header-font "'")) + (when text-font (str ",'@text_font': '" text-font "'")) + "});"))) ; google analytics code should appear in prod mode only (if-not (dev-mode?) (include-js "/js/google-analytics.js"))] [:body {:onload "loadPage()"} content])))