Login  Register

Upgrading Asciidoctor.js to the latest version of Asciidoctor

Posted by ggrossetie on Sep 20, 2013; 9:16pm
URL: https://discuss.asciidoctor.org/Upgrading-Asciidoctor-js-to-the-latest-version-of-Asciidoctor-tp636.html

Hi,

I cloned https://github.com/asciidoctor/asciidoctor.js and tried to build it but I had to modify few things :
 * gem install opal-sprockets
 * Add require 'opal-sprockets' in Rakefile
 * Replace syntax "boolean ? yesValue : noValue" in /lib/asciidoctor/lexer.rb around 1570 with :

        
        if value.nil?
          accessible = parent.document.delete_attribute(name)
        else
          accessible = parent.document.set_attribute(name, value)
        end

Then I successfully generated asciidoctor.js with Opal 0.4.4 but I had to manually edit the generated Javascript :

      def.$attr = function(name, default$, inherit) {
        var $a, $b;if (default == null) {

      def.$attr = function(name, default$, inherit) {
        var $a, $b;if (default$ == null) {

"default" parameter was missing a $ character but I have no clue why... I checked the helpers ruby class but there is no parameter named "default".

I was thinking maybe I can open an issue on Opal project but I don't really have much information to provide :(

I created a branch on asciidoctor.js to commit my changes and start working on cross-compiling asciidoctor 0.1.4. If someone is interested you're welcome to help :)

https://github.com/Mogztter/asciidoctor.js/tree/0.1.4
https://github.com/Mogztter/asciidoctor/tree/opal


Guillaume.