Skip to content

Commit

Permalink
Added a different default value for revealjsdir under node (fixes #191)
Browse files Browse the repository at this point in the history
Updated docs, tests and in-tree downstream users.
  • Loading branch information
obilodeau committed Nov 27, 2018
1 parent 9765846 commit 83d0247
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
9 changes: 3 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ var asciidoctorRevealjs = require('asciidoctor-reveal.js');
asciidoctorRevealjs.register()
// Convert the document 'presentation.adoc' using the reveal.js converter
var attributes = {'revealjsdir': 'node_modules/reveal.js@'};
var options = {safe: 'safe', backend: 'revealjs', attributes: attributes};
var options = {safe: 'safe', backend: 'revealjs'};
asciidoctor.convertFile('presentation.adoc', options); // <1>
----
<1> Creates a file named `presentation.html` (in the directory where command is run)
Expand All @@ -161,9 +160,6 @@ asciidoctor.convertFile('presentation.adoc', options); // <1>
[source, asciidoc]
----
= Title Slide
// depending on your npm version, you might need to override the default
// 'revealjsdir' value by removing the comments from the line below:
//:revealjsdir: node_modules/asciidoctor-reveal.js/node_modules/reveal.js
== Slide One
Expand Down Expand Up @@ -697,7 +693,8 @@ Default is built-in [path]_lib/css/zenburn.css_.
|<file\|URL>
|Overrides reveal.js directory.
Example: ../reveal.js or
https://cdnjs.com/libraries/reveal.js/3.6.0[https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0]
https://cdnjs.com/libraries/reveal.js/3.6.0[https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0].
Default is `reveal.js/` unless in a Nodejs environment where it is `node_modules/reveal.js/`.

|:revealjs_controls:
|*true*, false
Expand Down
2 changes: 1 addition & 1 deletion npm/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const asciidoctorRevealjs = require('../build/asciidoctor-reveal.js');
asciidoctorRevealjs.register()

// Convert *a* document using the reveal.js converter
var attributes = {'revealjsdir': 'node_modules/reveal.js@'};
var attributes = {'revealjsdir': 'reveal.js'};
var options = {safe: 'safe', backend: 'revealjs', attributes: attributes, to_dir: examplesDir};

fs.readdir(examplesDir, (err, files) => {
Expand Down
5 changes: 4 additions & 1 deletion templates/document.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ doctype 5
html lang=(attr :lang, 'en' unless attr? :nolang)
head
meta charset="utf-8"
- revealjsdir = (attr :revealjsdir, 'reveal.js')
- if RUBY_ENGINE == 'opal' && JAVASCRIPT_PLATFORM == 'node'
- revealjsdir = (attr :revealjsdir, 'node_modules/reveal.js')
- else
- revealjsdir = (attr :revealjsdir, 'reveal.js')
- unless (asset_uri_scheme = (attr 'asset-uri-scheme', 'https')).empty?
- asset_uri_scheme = %(#{asset_uri_scheme}:)
- cdn_base = %(#{asset_uri_scheme}//cdnjs.cloudflare.com/ajax/libs)
Expand Down
2 changes: 0 additions & 2 deletions test/js-babel/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ const asciidoctor = Asciidoctor()
import AsciidoctorRevealjs from 'asciidoctor-reveal.js'
AsciidoctorRevealjs.register()

const attributes = { revealjsdir: 'node_modules/reveal.js@' }
const options = {
safe: 'safe',
backend: 'revealjs',
attributes: attributes,
header_footer: true
}

Expand Down
3 changes: 1 addition & 2 deletions test/smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const expect = require('expect.js')
// Register the reveal.js converter
asciidoctorRevealjs.register()

const attributes = {'revealjsdir': 'node_modules/reveal.js@'}
const options = {safe: 'safe', backend: 'revealjs', attributes: attributes, 'header_footer': true}
const options = {safe: 'safe', backend: 'revealjs', 'header_footer': true}
const content = `= Title Slide
== Slide One
Expand Down

0 comments on commit 83d0247

Please sign in to comment.