From b9e30d0f22535a45b39fba05762e299c9e11e710 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 29 Mar 2014 17:26:46 -0400 Subject: [PATCH] make render-char public and allow it to be used standalone --- src/clj_figlet/core.clj | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/clj_figlet/core.clj b/src/clj_figlet/core.clj index e145147..12789bc 100644 --- a/src/clj_figlet/core.clj +++ b/src/clj_figlet/core.clj @@ -91,9 +91,10 @@ (defn- get-initial-output-lines [flf] (take (get-in flf [:header :height]) (repeat ""))) -(defn- render-char [^Character c flf lines] - (let [char-lines (get-in flf [:chars c]) - hardblank (get-in flf [:header :hardblank-str])] +(defn render-char [^Character c flf & [initial-output]] + (let [output-lines (or initial-output (get-initial-output-lines flf)) + char-lines (get-in flf [:chars c]) + hardblank (get-in flf [:header :hardblank-str])] (if char-lines (map (fn [^String char-line ^String output-line] @@ -103,8 +104,8 @@ (.replace "#" "") ; also used as an endline (.replace hardblank " ")))) char-lines - lines) - lines))) + output-lines) + output-lines))) (defn render-line [^String s flf & [initial-output]] (let [output (or initial-output (get-initial-output-lines flf))]