Fork me on GitHub
#hoplon
<
2016-06-01
>
onetom03:06:05

@dm3: (sift-jar :exclude ...)? i know about sift, but my question was really about what's the best way to concisely and precisely exclude everything but the files necessary at runtime.

leontalbot13:06:07

What do you use to support markdown in an Hoplon app?

leontalbot13:06:23

Can't find tailrecursion.hoplon.markdown

micha13:06:34

@leontalbot: in the past we rendered it at compile time with a cljs macro that used pegdown

micha13:06:40

i have some code somewhere

micha13:06:54

so like (markdown "...") in hoplon

micha13:06:20

i also made a yaml frontend for hoplon to make that a cleaner process

leontalbot13:06:30

my markdown text is not hardcoded

micha13:06:43

yeah you can use the js library then

leontalbot13:06:03

ok, but how to handle html strings in hoplon?

micha13:06:23

jquery can do it, no?

micha13:06:42

(js/jQuery "<h1>hello world</h1>")

micha13:06:49

or use innerHTML

micha13:06:08

basically the same way you'd handle html strings anywhere

leontalbot13:06:38

thanks, I've never used innerHTML or the jQuery thing before

micha13:06:46

lucky you 🙂

leontalbot14:06:27

(defn markdown [s]
  (->> s (.toHTML js/markdown) js/jQuery))

leontalbot14:06:54

(text "~(forms/markdown "*Hello!*")"))

micha14:06:01

there is a :html attribute also

leontalbot14:06:24

[object Object]

micha14:06:26

text makes a TextNode

micha14:06:43

try using jquery like i pasted

micha14:06:54

or the :html attribute

leontalbot14:06:22

using jQuery I get Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

leontalbot14:06:47

when I wrap jQuery with (text ...) I get [object Object]

micha14:06:25

the text macro creates a TextNode object

micha14:06:37

this object is text in the browser

micha14:06:45

it can't have children etc

micha14:06:47

it's just text

micha14:06:35

so how would it interpret something like new TextNode(someObject)?

micha14:06:52

considering that TextNode objects can only contain text

micha14:06:27

it would do the only thing it can do: new TextNode(someObject.toString())

micha14:06:48

and what do objects return when you call .toString() on them?

micha14:06:56

"[object Object]"

micha14:06:03

so it makes perfect sense in a way

micha14:06:21

you get a text node containing [object Object]

micha14:06:02

you should try it with hardcoded html string first

micha14:06:09

without any markdown libraries

micha14:06:19

figure out how that works, then try with markdown

micha14:06:47

like figure out how (div :html "<h1>foop</h1>") works

micha14:06:23

then try with your more complicated setup

leontalbot14:06:30

Thanks @micha @mynomoto , it works now

leontalbot14:06:53

@micha yeah, first things first

anisk16:06:59

Hey all... Possibly stupid question here... I'm trying to see if I'm doing something weird or if I misunderstood what loop-tpl does.... Is it supposed to keep things in order? In other words, if I have an array in a cell, if I use loop-tpl over the array, then filter, and conj on more things, etc. should the result of loop-tpl reflect the current order of the array?

micha17:06:53

@anisk: yes that's how it should work

flyboarder19:06:35

@onetom: would that not be what different source types are for in boot