Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi,
Is there a way to add a <script/> tag in the HTML page generated when using guard ? Example : ><script src="/javascripts/vendor/custom.modernizr.js"></script> If I add this property to the xxx.adoc page (:scriptsdir: ./javascript/vendor), nothing is added. Is there something else to do ? Regards, Charles
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist Twitter : @cmoulliard |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
Charles, There are (at least) two ways to add custom HTML, in this case JavaScript, to the output document. 1. docinfo file 2. passthrough block
For things like third-party JavaScript files, a docinfo file is the best way to go. See the docinfo file section in the user manual for details: http://asciidoctor.org/docs/user-manual/#docinfo-file
For custom HTML you need to insert at a specific location, such as a badge image, a passthrough block works best. See the passthrough block section in the user manual for details: http://asciidoctor.org/docs/user-manual/#passthrough-blocks
The scriptsdir attribute is used for resolving built-in JavaScript files (which Asciidoctor doesn't have anyway). However, you can use this attribute anywhere in the document or the docinfo file.
Let me know if something still isn't clear. Cheers, -Dan On Thu, Oct 3, 2013 at 11:07 AM, ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi, ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Alan,
Many thanks. That works fine adding the option using asciidoctor command line ' asciidoctor -b html5 -a docinfo test.adoc' or attribute directly in the doc :docinfo: Nevertheless, that does not work if I add the attribute to guard : guard 'shell' do watch(/^*\.adoc$/) {|m| Asciidoctor.render_file(m[0], { :in_place => true, :attributes => { 'backend' => 'html5', 'linkcss' => 'true', 'docinfo' => 'true' } }) } end Cheers Charles
Charles Moulliard
Apache Committer / Technologist Evangelist / Blogger / MiddleWare Specialist Twitter : @cmoulliard |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
Charles, It doesn't work when you use the API because you still need to set the safe mode option. guard 'shell' do watch(/^*\.adoc$/) {|m|
Asciidoctor.render_file(m[0], { :in_place => true, :safe => :unsafe, :attributes => { 'backend' => 'html5',
'linkcss' => '', 'docinfo' => '' } }) } end Btw, you can also set the backend using an option:
guard 'shell' do watch(/^*\.adoc$/) {|m| Asciidoctor.render_file(m[0], { :in_place => true, :safe => :unsafe,
:backend => :html5, :attributes => { 'linkcss' => '', 'docinfo' => '' } })
} end Though html5 is the default, so you really don't need to set it. You can also set the attributes using a string (or string-based array syntax) similar to how they are set on the commandline:
guard 'shell' do watch(/^*\.adoc$/) {|m| Asciidoctor.render_file(m[0], { :in_place => true, :safe => :unsafe,
:backend => :html5, :attributes => 'linkcss docinfo' }) } end Hopefully that should do the trick. -Dan On Fri, Oct 4, 2013 at 5:01 AM, ch007m [via Asciidoctor :: Discussion] <[hidden email]> wrote: Alan, ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen
|
Free forum by Nabble | Edit this page |