rewrite-hrefs bug fix (when :blog-prefix is blank)

When :blog-prefix in `config.edn` is set nil or "",
rewrite-hrefs should return `text` itself.
This commit is contained in:
ponkore 2016-01-10 23:40:19 +09:00
parent 839ed5c469
commit 792833facb

View file

@ -16,8 +16,8 @@
"Injects the blog prefix in front of any local links
ex. <img src='/img/cryogen.png'/> becomes <img src='/blog/img/cryogen.png'/>"
[blog-prefix text]
(if-not (s/blank? blog-prefix)
(if (s/blank? blog-prefix)
text
(clojure.string/replace text #"href=.?/|src=.?/" #(str (subs % 0 (dec (count %))) blog-prefix "/"))))
(defn markups