anmonteiro / lumo

Fast, cross-platform, standalone ClojureScript environment
Eclipse Public License 1.0
1.88k stars 84 forks source link

asciidoctor.js cannot be imported #106

Closed SevereOverfl0w closed 7 years ago

SevereOverfl0w commented 7 years ago

As first reported on lumo slack.

((node/require "asciidoctor.js"))

Did work with:

  1. Mies
  2. Self-hosted cljs

Does not work with Lumo though. Giving: TypeError: Cannot assign to read only property 'length' of object '[object String]'

There is a new error when this is added:

(def v8 (js/require "v8"))
(.setFlagsFromString v8 "--nouse_strict")
anmonteiro commented 7 years ago

This is fixed in master. This code works (as per http://asciidoctor.org/docs/install-and-use-asciidoctorjs/#using-asciidoctor-from-javascript):

cljs.user=> (def v8 (js/require "v8"))
#'cljs.user/v8
cljs.user=> (v8.setFlagsFromString "--nouse_strict")
nil
cljs.user=> (def ad (js/require "asciidoctor.js"))
#'cljs.user/ad
cljs.user=> (do
       #_=>  (ad)
       #_=>  nil)
nil
cljs.user=> (js/Opal.Asciidoctor.$convert
       #_=>  (str "http://asciidoctor.org[*Asciidoctor*] "
       #_=>   "running on http://opalrb.org[_Opal_] "
       #_=>   "brings AsciiDoc to the browser!"))
"<div class=\"paragraph\">\n<p><a href=\"http://asciidoctor.org\"><strong>Asciidoctor</strong></a> running on <a href=\"http://opalrb.org\"><em>Opal</em></a> brings AsciiDoc to the browser!</p>\n</div>"
cljs.user=>