The lookup of resources is dependant on the mode that marg is run. Using a dynamic var to set the resources dir depending on the conext.

This commit is contained in:
fogus 2011-01-25 11:48:46 -05:00
parent 4f5fb82785
commit 7624e83bd5
2 changed files with 13 additions and 11 deletions

View file

@ -43,9 +43,9 @@
(:gen-class))
(def *test* "src/marginalia/core.clj")
(def *docs* "./docs")
(def *comment* #"^\s*;;\s?")
(def ^{:dynamic true} *test* "src/marginalia/core.clj")
(def ^{:dynamic true} *docs* "./docs")
(def ^{:dynamic true} *comment* #"^\s*;;\s?")
;; ## File System Utilities
@ -214,7 +214,8 @@
(defn -main
"The main entry point into Marginalia."
[& sources]
(run-marginalia sources))
(binding [marginalia.html/*resources* ""]
(run-marginalia sources)))
;; # Example Usage

View file

@ -5,6 +5,7 @@
(:require [clojure.string :as str])
(:import [com.petebevin.markdown MarkdownProcessor]))
(def ^{:dynamic true} *resources* "./resources/")
(defn css-rule [rule]
(let [sels (reverse (rest (reverse rule)))
@ -351,16 +352,16 @@
[:head
[:meta {:http-equiv "Content-Type" :content "text/html" :charset "utf-8"}]
[:meta {:name "description" :content (:description project-metadata)}]
(inline-js "resources/jquery-1.4.4.min.js")
(inline-js "resources/xregexp-min.js")
(inline-js "resources/shCore.js")
(inline-js "resources/shBrushClojure.js")
(inline-js "resources/app.js")
(inline-js (str *resources* "jquery-1.4.4.min.js"))
(inline-js (str *resources* "xregexp-min.js"))
(inline-js (str *resources* "shCore.js"))
(inline-js (str *resources* "shBrushClojure.js"))
(inline-js (str *resources* "app.js"))
#_[:script {:type "text/javascript" :src "./../resources/app.js"}]
(inline-css "resources/shCore.css")
(inline-css (str *resources* "shCore.css"))
(css
[:.syntaxhighlighter {:overflow "hidden !important"}])
(inline-css "resources/shThemeEclipse.css")
(inline-css (str *resources* "shThemeEclipse.css"))
reset-css
header-css
floating-toc-css