Created
July 23, 2021 12:51
-
-
Save Cartmanishere/9193b9d3b903c5e650a9a6af8c014207 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clj-handlebars.http-loader | |
(:gen-class | |
:init init | |
:state state | |
:name com.github.jknack.handlebars.io.HTTPCljLoader | |
:implements [com.github.jknack.handlebars.io.TemplateLoader] | |
:constructors {[String] []} | |
:prefix "-") | |
(:import [com.github.jknack.handlebars.io URLTemplateSource] | |
[java.net URL])) | |
(defn -init | |
[^String baseUrl] | |
[[] {:prefix baseUrl | |
:suffix ".hbs"}]) | |
(defn -resolve | |
[this filename] | |
(str (. this getPrefix) filename (. this getSuffix))) | |
(defn -getPrefix | |
[this] | |
(str (:prefix (.state this)))) | |
(defn -getSuffix | |
[this] | |
(str (:suffix (.state this)))) | |
(defn -sourceAt | |
[this uri] | |
(let [location (. this resolve uri)] | |
(URLTemplateSource. location (URL. location)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment