Syntax to be used to pass options/attributes to asciidoc js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax to be used to pass options/attributes to asciidoc js

ch007m
Hi,

The asciidoc.js project mentions that Opal.hash2 must be used to pass options,attributes to asciidoctor.js
If I try to do that

var asciidocOpts = Opal.hash2(['options'], {'options': ['doctype', 'book']});

Screenshot_2014-03-18_18.02.47.png

The result generated does not display the title of the book + author name and version. Is it an issue with my syntax or a bug with asciidoctor.js ? See screenshot

Regards,
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard
Reply | Threaded
Open this post in threaded view
|

Re: Syntax to be used to pass options/attributes to asciidoc js

LightGuardjp
As things currently stand today, you're probably sending strings when on the ruby side it's expecting symbols. I recall Dan and Alex having a discussion about that. If it's a symbol in ruby use ':attribute-name' instead of just 'attribute-name', same goes for values. Give that a try.


On Tue, Mar 18, 2014 at 11:05 AM, ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

The asciidoc.js project mentions that Opal.hash2 must be used to pass options,attributes to asciidoctor.js
If I try to do that


var asciidocOpts = Opal.hash2(['options'], {'options': ['doctype', 'book']});
</raw2

<nabble_a href="Screenshot_2014-03-18_18.02.47.png">Screenshot_2014-03-18_18.02.47.png

The result generated does not display the title of the book + author name and version. Is it an issue with my syntax or a bug with asciidoctor.js ? See screenshot

Regards,
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Syntax-to-be-used-to-pass-options-attributes-to-asciidoc-js-tp1620.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Syntax to be used to pass options/attributes to asciidoc js

ch007m
Does not work if I use also the symbol

var asciidocOpts = Opal.hash2(['options'], {'options': [':doctype', 'book']});


On Tue, Mar 18, 2014 at 7:47 PM, LightGuardjp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
As things currently stand today, you're probably sending strings when on the ruby side it's expecting symbols. I recall Dan and Alex having a discussion about that. If it's a symbol in ruby use ':attribute-name' instead of just 'attribute-name', same goes for values. Give that a try.


On Tue, Mar 18, 2014 at 11:05 AM, ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

The asciidoc.js project mentions that Opal.hash2 must be used to pass options,attributes to asciidoctor.js
If I try to do that


var asciidocOpts = Opal.hash2(['options'], {'options': ['doctype', 'book']});
</raw2

<nabble_a href="Screenshot_2014-03-18_18.02.47.png">Screenshot_2014-03-18_18.02.47.png

The result generated does not display the title of the book + author name and version. Is it an issue with my syntax or a bug with asciidoctor.js ? See screenshot

Regards,
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Syntax-to-be-used-to-pass-options-attributes-to-asciidoc-js-tp1620.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Syntax-to-be-used-to-pass-options-attributes-to-asciidoc-js-tp1620p1621.html
To unsubscribe from Syntax to be used to pass options/attributes to asciidoc js, click here.
NAML



--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist
Twitter : @cmoulliard
Reply | Threaded
Open this post in threaded view
|

Re: Syntax to be used to pass options/attributes to asciidoc js

asotobu
Yes we are discussing about symbols for languages which don't have symbols. We need to make some research because does the users of Asciidoctor from none Ruby world should take care that there are something called symbols in Ruby? Or we should provide some kind of wrappers?

Well this is where we are now.
Reply | Threaded
Open this post in threaded view
|

Re: Syntax to be used to pass options/attributes to asciidoc js

mojavelinux
Administrator
In reply to this post by ch007m
In Opal, strings are just symbols and vice verse. There is no distinction.

On Wed, Mar 19, 2014 at 2:17 AM, ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Does not work if I use also the symbol

var asciidocOpts = Opal.hash2(['options'], {'options': [':doctype', 'book']});

You should put the options inside an options key. It's already a hash of options, so you just use the names directly. In other words, you'd write:

[source,js]
----
var asciidocOpts = Opal.hash2(['doctype'], {'doctype': 'book'});
----

For more examples, see the source of the Chrome extension (or anything based on Asciidoctor.js).


-Dan