Fork me on GitHub
#hoplon
<
2015-11-23
>
andrewboltachev09:11:14

Hi. I'm playing with macros in ClojureScript (inside a Hoplon project) and there's what I got: http://dpaste.com/1RB43RF I want on my page call a library function which appeals to a macro. But seems that I can't pass a value through, macro receives what is gots inline.

andrewboltachev09:11:26

Is this Hoplon feature or the way ClojureScript works in general?

dm309:11:24

what are you trying to accomplish?

andrewboltachev09:11:20

@dm3 I'm doing my portfolio website. I want to create multilanguage version in some crazy way 😛

dm309:11:47

I mean what's your idea with the macro? simple_smile

andrewboltachev09:11:31

the thing is just that I need to pass a value...

andrewboltachev09:11:14

I would have HTML (well, DOM-generating) content which I would have as a vector, and I would parse it, and extract strings in one language, and have maps from that one to other languages and based on parameter passed to macro return version in particular language

andrewboltachev10:11:31

i.e. in *.clj file I would have (1) data, which is (def data '(html (body (div "hello!.."))) (that way with quote) and a macro which either returns it directly (when parameter language is nil) or substitutes all the strings like "hello..." using the map which would be also somewhere...

andrewboltachev10:11:24

@dm3: please see above

dm310:11:34

so you want to generate static html from a single source?

dm310:11:51

you could describe html in something like https://github.com/weavejester/hiccup and use simple functions to process it, as it's just vectors and maps

dm310:11:10

no need for macros

andrewboltachev10:11:53

thanks, but I got interested in that macro stuff... and, it seems that I already have a workaround

andrewboltachev10:11:42

'cause when I call macro directly from my whatever.cljs.hl file (one with (page ...) in it), macro receives actual value

andrewboltachev10:11:20

and, it's Hoplon after all 😉

andrewboltachev10:11:08

though, Hiccup looks nice, i.e. it's «doing one function and doing it well» (as of Unix philosophy)