Executes the format with the arguments. This should never be used directly, but is public
because the formatter macro uses it.
(defn execute-format
"Executes the format with the arguments. This should never be used directly, but is public
because the formatter macro uses it."
{:skip-wiki true}
([stream format args]
(let [^java.io.Writer real-stream (cond
(not stream) (java.io.StringWriter.)
(true? stream) *out*
:else stream)
^java.io.Writer wrapped-stream (if (and (needs-pretty format)
(not (pretty-writer? real-stream)))
(get-pretty-writer real-stream)
real-stream)]
(binding [*out* wrapped-stream]
(try
(execute-format format args)
(finally
(if-not (identical? real-stream wrapped-stream)
(.flush wrapped-stream))))
(if (not stream) (.toString real-stream)))))
([format args]
(map-passing-context
(fn [element context]
(if (abort? context)
[nil context]
(let [[params args] (realize-parameter-list
(:params element) context)
[params offsets] (unzip-map params)
params (assoc params :base-args args)]
[nil (apply (:func element) [params args offsets])])))
args
format)))
Comments top
No comments for execute-format. Log in to add a comment.