Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove empty lines in the reveal.js dependencies configuration #327

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions templates/document.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,7 @@ html lang=(attr :lang, 'en' unless attr? :nolang)

// Optional libraries used to extend on reveal.js
dependencies: [
#{(document.attr? 'source-highlighter', 'highlightjs') ? "{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true }," : nil}
#{(attr? 'revealjs_plugin_zoom', 'disabled') ? "" : "{ src: '#{revealjsdir}/plugin/zoom-js/zoom.js', async: true }," }
#{(attr? 'revealjs_plugin_notes', 'disabled') ? "" : "{ src: '#{revealjsdir}/plugin/notes/notes.js', async: true }," }
#{(attr? 'revealjs_plugin_marked', 'enabled') ? "{ src: '#{revealjsdir}/plugin/markdown/marked.js' }," : "" }
#{(attr? 'revealjs_plugin_markdown', 'enabled') ? "{ src: '#{revealjsdir}/plugin/markdown/markdown.js' }," : "" }
#{(attr? 'revealjs_plugins') ? File.read(attr('revealjs_plugins', '')) : ""}
#{revealjs_dependencies(document, self, revealjsdir)}
],

#{(attr? 'revealjs_plugins_configuration') ? File.read(attr('revealjs_plugins_configuration', '')) : ""}
Expand Down
15 changes: 15 additions & 0 deletions templates/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ def section_title(sec = self)
end
end

def revealjs_dependencies(document, node, revealjsdir)
dependencies = []
dependencies << "{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true }" if (document.attr? 'source-highlighter', 'highlightjs')
obilodeau marked this conversation as resolved.
Show resolved Hide resolved
dependencies << "{ src: '#{revealjsdir}/plugin/zoom-js/zoom.js', async: true }" unless (node.attr? 'revealjs_plugin_zoom', 'disabled')
dependencies << "{ src: '#{revealjsdir}/plugin/notes/notes.js', async: true }" unless (node.attr? 'revealjs_plugin_notes', 'disabled')
dependencies << "{ src: '#{revealjsdir}/plugin/markdown/marked.js', async: true }" if (node.attr? 'revealjs_plugin_marked', 'enabled')
dependencies << "{ src: '#{revealjsdir}/plugin/markdown/markdown.js', async: true }" if (node.attr? 'revealjs_plugin_markdown', 'enabled')
if (node.attr? 'revealjs_plugins') &&
!(revealjs_plugins_file = (node.attr 'revealjs_plugins', '').strip).empty? &&
!(revealjs_plugins_content = (File.read revealjs_plugins_file).strip).empty?
dependencies << revealjs_plugins_content
end
dependencies.join(",\n ")
end


# Between delimiters (--) is code taken from asciidoctor-bespoke 1.0.0.alpha.1
# Licensed under MIT, Copyright (C) 2015-2016 Dan Allen and the Asciidoctor Project
Expand Down
6 changes: 1 addition & 5 deletions test/doctest/fragments.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,8 @@ <h2>Using data-fragment</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down
6 changes: 1 addition & 5 deletions test/doctest/history-hash.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,8 @@ <h2>Third slide</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down
6 changes: 1 addition & 5 deletions test/doctest/history-regression-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,8 @@ <h2>hello 你好</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down
6 changes: 1 addition & 5 deletions test/doctest/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,8 @@ <h2>Third slide</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down
6 changes: 1 addition & 5 deletions test/doctest/links-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,8 @@ <h2>Inlined Images</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down
6 changes: 1 addition & 5 deletions test/doctest/revealjs-plugin-activation.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,8 @@ <h2>Slide 2</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down
6 changes: 1 addition & 5 deletions test/doctest/revealjs-plugins.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,10 @@ <h2>Slide 2</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },


{ src: 'revealjs-plugins/reveal.js-menu/menu.js' },
{ src: 'revealjs-plugins/chalkboard/chalkboard.js' }

{ src: 'revealjs-plugins/chalkboard/chalkboard.js' }
],

menu: {
Expand Down
6 changes: 1 addition & 5 deletions test/doctest/theme-custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,8 @@ <h2>Actually, they are…​</h2>

// Optional libraries used to extend on reveal.js
dependencies: [

{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },



{ src: 'reveal.js/plugin/notes/notes.js', async: true }
],


Expand Down