site

Website's source files.
Log | Files | Refs | Submodules | LICENSE

commit 2b84310f598e670f61dfa2e58fcd83e4886f712e
parent 0e28eb51383cf7285f8566840f16f83a95ca0a09
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date:   Thu, 10 Feb 2022 16:44:15 -0800

Implement dynamic templates

Diffstat:
Msrc/main/rmjxyz/app.cljs | 10+++++-----
Mviews/partials/terminalTemplate.handlebars | 2+-
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/rmjxyz/app.cljs b/src/main/rmjxyz/app.cljs @@ -56,7 +56,7 @@ :numLinks (.-nlink stats) :fileSize (gstring/format "%4d" (.-size stats)) :mtime (ls-time (.-mtimeMs stats)) - :basename (.basename path file-path) } + :basename (.-name (.parse path (.basename path file-path))) } ;; TODO actually deal with error. (js/console.error "Could not stat" file-path)))) @@ -83,8 +83,8 @@ ([dir ext paths] {"args" dir "lsList" (ls-list dir ext paths)}) ;; Cat. - ([path] {"args" path - "markup" (.readFileSync fs path "utf8")})) + ([the-path] {"args" the-path + "markup" (.-name (.parse path the-path))})) (defn create-ls "Create a ls-listing from a pre-existing set of files." @@ -116,7 +116,7 @@ (<p! (.readFile fs file "utf8" (fn [err buf] (if err (js/console.log "Error when looking for item " file) - (serve-200 "post" res #js{ "text" buf }))))) + (serve-200 "post" res #js{ :text buf }))))) ;; TOTO internal error. (catch js/Error err (js/console.error err))))) @@ -137,7 +137,7 @@ (.get server "/posts/:post" (fn [^js req res next] (let [post (.toLowerCase (.-post (.-params req)))] (if (some #(= post %) (get @post-items :content)) - (serve-file-to post res) + (serve-200 "index" res (clj->js (merge ))) (serve-404 post res))))) (.get server "/posts" (fn [^js req res next] (serve-200 "index" res (clj->js (merge @post-windows diff --git a/views/partials/terminalTemplate.handlebars b/views/partials/terminalTemplate.handlebars @@ -7,7 +7,7 @@ <hr class="prompt-break"> <span class="prompt1">ryan</span><span class="prompt2">@</span><span class="prompt3">themainframe</span><span class="prompt4"></span> <span>cat {{args}}</span> <div class="cat"> - {{{markup}}} + {{> (lookup . 'markup')}} </div> {{else}} <hr class="prompt-break">