Skip to content

Commit

Permalink
text renderer added
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Dec 25, 2019
1 parent 9e19a3c commit 9aecf1d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject org.pinkgorilla/gorilla-renderable "2.1.9"
(defproject org.pinkgorilla/gorilla-renderable "2.1.12"
:description "The protocol for custom rendering in Pink Gorilla Notebook."
:url "https://github.com/pink-gorilla/gorilla-renderable"
:license {:name "MIT"}
Expand Down
4 changes: 3 additions & 1 deletion src/pinkgorilla/ui/rendererCLJS.cljs
Expand Up @@ -44,7 +44,9 @@
(render [self]
(span-render self "clj-symbol")))


; would be cool to be able to use meta data to switch between
; if meta ^:br is set, then convert \n to [:br] otherwise render the string as it is.
; however clojure does not support meta data for strings
(extend-type string
Renderable
(render [self]
Expand Down
19 changes: 19 additions & 0 deletions src/pinkgorilla/ui/text.cljc
@@ -0,0 +1,19 @@
(ns pinkgorilla.ui.text
"plugin to render text in pink-gorilla"
(:require
[pinkgorilla.ui.gorilla-renderable :refer :all] ; define Renderable (which has render function)
))

(defn text! [text]
"renders text to a gorilla cell"
(reify Renderable
(render [_]
{:type :text
:content
{:text text
}
;:value (pr-str self) ; DO NOT SET VALUE; this will fuckup loading. (at least in original gorilla)
})
))


0 comments on commit 9aecf1d

Please sign in to comment.