diff --git a/.gitignore b/.gitignore index dc8257dd..3117dbcb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,12 +4,17 @@ # test stuff /examples/*.html /examples/reveal.js/ +/test/doctest/reveal.js/ # node stuff node_modules/ npm-debug.log build/ +/dist/main.js # ruby stuff /.bundle/ /Gemfile.lock + +# the compiled slim template +/lib/asciidoctor-revealjs/converter.rb diff --git a/.travis.yml b/.travis.yml index 6606d72e..e7e35d1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ git: # use depth 2 just in case two refs get pushed at once (like a tag) depth: 2 language: ruby +node_js: lts/* rvm: - 2.4 - 2.3 @@ -17,7 +18,11 @@ env: # use system libraries to speed up installation of nokogiri - NOKOGIRI_USE_SYSTEM_LIBRARIES=true script: +- bundle exec rake build - bundle exec rake doctest - bundle exec rake examples:convert +- npm install +- npm run build + notifications: email: false diff --git a/HACKING.adoc b/HACKING.adoc index 2d195a0a..5238d21f 100644 --- a/HACKING.adoc +++ b/HACKING.adoc @@ -102,6 +102,7 @@ done with `bundler`: bundle config --local github.https true bundle --path=.bundle/gems --binstubs=.bundle/.bin + bundle exec rake build Go to `test/output/slim/` folder and install `reveal.js`: @@ -207,7 +208,7 @@ In order to test the Node package, you need to create a test project adjacent to Now, install the dependencies: - $ npm i --save asciidoctor.js@1.5.5-3 + $ npm i --save asciidoctor.js@1.5.6-preview.3 $ npm i --save ../asciidoctor-reveal.js NOTE: The relative portion of the last command is where you are installing the local `asciidoctor-reveal.js` version from. @@ -215,6 +216,24 @@ NOTE: The relative portion of the last command is where you are installing the l Then proceed as documented in the `README.adoc`. +== RubyGem package + +=== Test a local asciidoctor-revealjs version + +Compile the converter: + + $ bundle exec rake build + +In a clean directory besides the `asciidoctor-reveal.js` repository, create the following `Gemspec` file: + + source 'https://rubygems.org' + gem 'asciidoctor-revealjs', :path => '../asciidoctor-reveal.js' + +Then run: + + $ bundle --path=.bundle/gems --binstubs=.bundle/.bin + + == Release process . Update the version in `lib/asciidoctor-revealjs/version.rb` and `package.json` @@ -232,6 +251,7 @@ Then proceed as documented in the `README.adoc`. . Make a release on github (from changelog and copy from previous releases) . Pushing the gem on rubygems.org: + + $ bundle exec rake build $ gem build asciidoctor-revealjs.gemspec $ gem push asciidoctor-revealjs-X.Y.Z.gem diff --git a/README.adoc b/README.adoc index 5af0b110..77ec33e5 100644 --- a/README.adoc +++ b/README.adoc @@ -82,7 +82,6 @@ NOTE: These instructions should be repeated for every presentation project. source 'https://rubygems.org' gem 'asciidoctor-revealjs' # latest released version -#gem 'asciidoctor-revealjs', github: 'asciidoctor/asciidoctor-reveal.js' # github master branch ---- + NOTE: For some reason, when you use the system Ruby on Fedora, you also have to add the json gem to the Gemfile. @@ -133,14 +132,12 @@ Here we are converting a file named `presentation.adoc` into a reveal.js present ---- // Load asciidoctor.js and asciidoctor-reveal.js var asciidoctor = require('asciidoctor.js')(); -var Asciidoctor = asciidoctor.Asciidoctor(); - require('asciidoctor-reveal.js'); // Convert the document 'presentation.adoc' using the reveal.js converter -var attributes = 'revealjsdir=node_modules/reveal.js@'; +var attributes = {'revealjsdir': 'node_modules/reveal.js@'}; var options = {safe: 'safe', backend: 'revealjs', attributes: attributes}; -Asciidoctor.convertFile('presentation.adoc', options); // <1> +asciidoctor.convertFile('presentation.adoc', options); // <1> ---- <1> Creates a file named `presentation.html` (in the directory where command is run) @@ -162,7 +159,7 @@ Asciidoctor.convertFile('presentation.adoc', options); // <1> To render the slides, run: - node asciidoctor-reveal.js + node asciidoctor-revealjs.js You can open the `presentation.html` file in your browser and enjoy! diff --git a/Rakefile b/Rakefile index 6f890d4c..df9c6b2f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,14 +1,83 @@ +#!/usr/bin/env rake + require 'asciidoctor' require 'asciidoctor/doctest' require 'colorize' require 'thread_safe' require 'tilt' +CONVERTER_FILE = 'lib/asciidoctor-revealjs/converter.rb' +TEMPLATES_DIR = 'templates' + +namespace :build do + require 'asciidoctor-templates-compiler' + require 'slim-htag' + + generator = if :mode == :opal + Temple::Generators::ArrayBuffer.new(freeze_static: false) + else + Temple::Generators::StringBuffer + end + + file CONVERTER_FILE, [:mode] => FileList["#{TEMPLATES_DIR}/*"] do |t, args| + #require 'asciidoctor-templates-compiler' + require_relative 'lib/asciidoctor-templates-compiler' + require 'slim-htag' + + File.open(CONVERTER_FILE, 'w') do |file| + $stderr.puts "Generating #{file.path}." + Asciidoctor::TemplatesCompiler::RevealjsSlim.compile_converter( + templates_dir: TEMPLATES_DIR, + class_name: 'Asciidoctor::Revealjs::Converter', + register_for: ['revealjs'], + backend_info: { + basebackend: 'html', + outfilesuffix: '.html', + filetype: 'html', + }, + delegate_backend: 'html5', + engine_opts: { + generator: generator, + }, + pretty: (args[:mode] == :pretty), + output: file) + end + end + + namespace :converter do + desc 'Compile Slim templates and generate converter.rb (pretty mode)' + task :pretty do + Rake::Task[CONVERTER_FILE].invoke(:pretty) + end + + desc 'Compile Slim templates and generate converter.rb (fast mode)' + task :fast do + Rake::Task[CONVERTER_FILE].invoke + end + end + + task :converter => 'converter:pretty' +end + +task :build => 'build:converter:pretty' + +task :clean do + rm_rf CONVERTER_FILE +end + DocTest::RakeTasks.new do |t| - t.output_examples :html, path: 'test/output/slim' + t.output_examples :html, path: 'test/doctest' t.input_examples :asciidoc, path: [ *DocTest.examples_path, 'examples' ] t.converter = DocTest::HTML::Converter - t.converter_opts = { template_dirs: 'templates/slim' } + t.converter_opts = { backend_name: 'revealjs' } +end + +task 'prepare-converter' do + # Run as an external process to ensure that it will not affect tests + # environment with extra loaded modules (especially slim). + `bundle exec rake build:converter:fast` + + require_relative 'lib/asciidoctor-revealjs' end namespace :examples do @@ -21,7 +90,7 @@ namespace :examples do :safe => 'safe', :backend => 'revealjs', :base_dir => 'examples', - :template_dir => 'templates/slim' + :template_dir => 'templates' if out.instance_of? Asciidoctor::Document puts "✔️".green else @@ -31,5 +100,7 @@ namespace :examples do end end +task 'doctest:test' => 'prepare-converter' +task 'doctest:generate' => 'prepare-converter' # When no task specified, run test. task :default => :doctest diff --git a/asciidoctor-revealjs.gemspec b/asciidoctor-revealjs.gemspec index 75976bea..006a7fb6 100644 --- a/asciidoctor-revealjs.gemspec +++ b/asciidoctor-revealjs.gemspec @@ -25,11 +25,13 @@ Gem::Specification.new do |s| s.require_paths = ['lib'] s.add_runtime_dependency 'asciidoctor', '~> 1.5.6' - s.add_runtime_dependency 'slim', '~> 3.0.6' s.add_runtime_dependency 'thread_safe', '~> 0.3.5' s.add_development_dependency 'rake', '~> 10.4.2' s.add_development_dependency 'asciidoctor-doctest', '= 2.0.0.beta.4' s.add_development_dependency 'pry', '~> 0.10.4' s.add_development_dependency 'colorize' + s.add_development_dependency 'asciidoctor-templates-compiler', '~> 0.3.0' + s.add_development_dependency 'slim', '~> 3.0.6' + s.add_development_dependency 'slim-htag', '~> 0.1.0' end diff --git a/dist/main.js b/dist/main.js deleted file mode 100644 index 0c72c416..00000000 --- a/dist/main.js +++ /dev/null @@ -1,64 +0,0 @@ -/* Generated by Opal 0.10.1 */ -Opal.modules["asciidoctor-revealjs/converter"] = function(Opal) { - function $rb_plus(lhs, rhs) { - return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); - } - var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; - - Opal.add_stubs(['$==', '$register_for', '$[]', '$+', '$map', '$expand_path', '$new', '$merge', '$basebackend', '$htmlsyntax']); - if ($scope.get('RUBY_ENGINE')['$==']("opal")) {}; - return (function($base) { - var $Asciidoctor, self = $Asciidoctor = $module($base, 'Asciidoctor'); - - var def = self.$$proto, $scope = self.$$scope; - - (function($base) { - var $Revealjs, self = $Revealjs = $module($base, 'Revealjs'); - - var def = self.$$proto, $scope = self.$$scope; - - (function($base, $super) { - function $Converter(){}; - var self = $Converter = $klass($base, $super, 'Converter', $Converter); - - var def = self.$$proto, $scope = self.$$scope, TMP_2; - - Opal.cdecl($scope, 'ProvidedTemplatesDir', (function() {if ($scope.get('RUBY_ENGINE')['$==']("opal")) { - return "node_modules/asciidoctor-reveal.js/templates"}; return nil; })()); - - self.$register_for("revealjs"); - - return (Opal.defn(self, '$initialize', TMP_2 = function ːinitialize(backend, opts) { - var $a, $b, TMP_1, $c, self = this, $iter = TMP_2.$$p, $yield = $iter || nil, template_dirs = nil, user_template_dirs = nil, template_engine = nil, template_converter = nil, html5_converter = nil; - - if (opts == null) { - opts = $hash2([], {}); - } - TMP_2.$$p = null; - template_dirs = [$scope.get('ProvidedTemplatesDir')]; - if ((($a = (user_template_dirs = opts['$[]']("template_dirs"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { - template_dirs = $rb_plus(template_dirs, ($a = ($b = user_template_dirs).$map, $a.$$p = (TMP_1 = function(d){var self = TMP_1.$$s || this; -if (d == null) d = nil; - return Opal.get('File').$expand_path(d)}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b))}; - if ($scope.get('RUBY_ENGINE')['$==']("opal")) { - template_engine = "jade"}; - template_converter = ((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('TemplateConverter')).$new(backend, template_dirs, (opts.$merge($hash2(["htmlsyntax", "template_engine"], {"htmlsyntax": "html", "template_engine": template_engine})))); - html5_converter = ((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('Html5Converter')).$new(backend, opts); - ($a = ($c = self, Opal.find_super_dispatcher(self, 'initialize', TMP_2, false)), $a.$$p = null, $a).call($c, backend, template_converter, html5_converter); - self.$basebackend("html"); - return self.$htmlsyntax("html"); - }, TMP_2.$$arity = -2), nil) && 'initialize'; - })($scope.base, ((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('CompositeConverter'))) - })($scope.base) - })($scope.base); -}; - -/* Generated by Opal 0.10.1 */ -(function(Opal) { - var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; - - Opal.add_stubs(['$==', '$require']); - if ($scope.get('RUBY_ENGINE')['$==']("opal")) { - self.$require("asciidoctor-revealjs/converter"); - return require('asciidoctor-template.js');} -})(Opal); diff --git a/lib/asciidoctor-revealjs.rb b/lib/asciidoctor-revealjs.rb index 58152a0a..039a291c 100644 --- a/lib/asciidoctor-revealjs.rb +++ b/lib/asciidoctor-revealjs.rb @@ -1,6 +1,5 @@ if RUBY_ENGINE == 'opal' require 'asciidoctor-revealjs/converter' - `require('asciidoctor-template.js')` else require 'asciidoctor' unless defined? Asciidoctor::Converter require_relative 'asciidoctor-revealjs/converter' diff --git a/lib/asciidoctor-revealjs/converter.rb b/lib/asciidoctor-revealjs/converter.rb deleted file mode 100644 index e3ecdbaf..00000000 --- a/lib/asciidoctor-revealjs/converter.rb +++ /dev/null @@ -1,38 +0,0 @@ -unless RUBY_ENGINE == 'opal' - require 'asciidoctor/converter/html5' - require 'asciidoctor/converter/composite' - require 'asciidoctor/converter/template' -end - -module Asciidoctor; module Revealjs - - class Converter < ::Asciidoctor::Converter::CompositeConverter - ProvidedTemplatesDir = RUBY_ENGINE == 'opal' ? 'node_modules/asciidoctor-reveal.js/templates' : (::File.expand_path '../../../templates', __FILE__) - register_for 'revealjs' - - def initialize backend, opts = {} - # merge user templates with provided templates (user wins) - template_dirs = [ProvidedTemplatesDir] - if (user_template_dirs = opts[:template_dirs]) - template_dirs += user_template_dirs.map {|d| ::File.expand_path d } - end - # Engine Opal means we need to use the Javascript based templates - if RUBY_ENGINE == 'opal' - template_engine = 'jade' - else - template_engine = 'slim' - end - # create the main converter - template_converter = ::Asciidoctor::Converter::TemplateConverter.new backend, - template_dirs, - (opts.merge htmlsyntax: 'html', template_engine: template_engine) - # create the delegate / fallback converter - html5_converter = ::Asciidoctor::Converter::Html5Converter.new backend, opts - # fuse the converters together - super backend, template_converter, html5_converter - basebackend 'html' - htmlsyntax 'html' - end - end - -end; end diff --git a/lib/asciidoctor-templates-compiler.rb b/lib/asciidoctor-templates-compiler.rb new file mode 100644 index 00000000..ff76edbb --- /dev/null +++ b/lib/asciidoctor-templates-compiler.rb @@ -0,0 +1,11 @@ +require 'asciidoctor-templates-compiler' + +module Asciidoctor::TemplatesCompiler + class RevealjsSlim < Asciidoctor::TemplatesCompiler::Slim + def engine_options + ::Asciidoctor::Converter::TemplateConverter::DEFAULT_ENGINE_OPTIONS[:slim].merge( + generator: Temple::Generators::ArrayBuffer.new(capture_generator: 'ArrayBuffer') + ) + end + end +end diff --git a/npm/builder.js b/npm/builder.js index e42f518e..6302a155 100644 --- a/npm/builder.js +++ b/npm/builder.js @@ -1,5 +1,6 @@ module.exports = Builder; +var fs = require('fs'); var async = require('async'); var log = require('bestikk-log'); var bfs = require('bestikk-fs'); @@ -49,7 +50,7 @@ Builder.prototype.compile = function (callback) { var opalCompiler = new OpalCompiler({dynamicRequireLevel: 'ignore'}); opalCompiler.compile('asciidoctor-revealjs', 'build/asciidoctor-revealjs.js', ['lib']); typeof callback === 'function' && callback(); -} +}; Builder.prototype.copyToDist = function (callback) { var builder = this; diff --git a/package.json b/package.json index 6ab07c24..19e8c99a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ }, "files": [ "dist", - "templates/jade", "LICENSE.adoc", "README.adoc" ], @@ -40,14 +39,13 @@ }, "homepage": "https://github.com/asciidoctor/asciidoctor-reveal.js", "dependencies": { - "asciidoctor-template.js": "1.5.5-3", "reveal.js": "3.3.0" }, "devDependencies": { "async": "^1.5.0", "bestikk-fs": "^0.1.0", "bestikk-log": "0.1.0", - "bestikk-opal-compiler": "0.2.0" + "bestikk-opal-compiler": "0.3.0-integration7" }, "readme": "# Reveal.js converter for Asciidoctor\n\n[Asciidoctor reveal.js](https://github.com/asciidoctor/asciidoctor-reveal.js) is a converter for [Asciidoctor](https://github.com/asciidoctor/asciidoctor) and [Asciidoctor.js](https://github.com/asciidoctor/asciidoctor.js) that transforms an AsciiDoc document into an HTML5 presentation designed to be executed by the [reveal.js](http://lab.hakim.se/reveal-js/) presentation framework.\n\nThis is the npm module. For setup instructions and the AsciiDoc syntax to use to write a presentation see the module's documentation at [https://github.com/asciidoctor/asciidoctor-reveal.js](https://github.com/asciidoctor/asciidoctor-reveal.js).\n" } diff --git a/templates/slim/block_admonition.html.slim b/templates/admonition.html.slim similarity index 100% rename from templates/slim/block_admonition.html.slim rename to templates/admonition.html.slim diff --git a/templates/slim/block_audio.html.slim b/templates/audio.html.slim similarity index 100% rename from templates/slim/block_audio.html.slim rename to templates/audio.html.slim diff --git a/templates/slim/block_colist.html.slim b/templates/colist.html.slim similarity index 100% rename from templates/slim/block_colist.html.slim rename to templates/colist.html.slim diff --git a/templates/slim/block_dlist.html.slim b/templates/dlist.html.slim similarity index 100% rename from templates/slim/block_dlist.html.slim rename to templates/dlist.html.slim diff --git a/templates/slim/document.html.slim b/templates/document.html.slim similarity index 100% rename from templates/slim/document.html.slim rename to templates/document.html.slim diff --git a/templates/slim/embedded.html.slim b/templates/embedded.html.slim similarity index 100% rename from templates/slim/embedded.html.slim rename to templates/embedded.html.slim diff --git a/templates/slim/block_example.html.slim b/templates/example.html.slim similarity index 100% rename from templates/slim/block_example.html.slim rename to templates/example.html.slim diff --git a/templates/floating_title.html.slim b/templates/floating_title.html.slim new file mode 100644 index 00000000..0728e3b2 --- /dev/null +++ b/templates/floating_title.html.slim @@ -0,0 +1,2 @@ +h level=(level + 1) id=id class=[style, role] + =title diff --git a/templates/helpers.rb b/templates/helpers.rb new file mode 100644 index 00000000..4e7d61fa --- /dev/null +++ b/templates/helpers.rb @@ -0,0 +1,99 @@ +unless RUBY_ENGINE == 'opal' + # This helper file borrows from the Bespoke converter + # https://github.com/asciidoctor/asciidoctor-bespoke + require 'asciidoctor' +end + +# This module gets mixed in to every node (the context of the template) at the +# time the node is being converted. The properties and methods in this module +# effectively become direct members of the template. +module Slim::Helpers + + EOL = %(\n) + SliceHintRx = / +/ + + def slice_text str, active = nil + if (active || (active.nil? && (option? :slice))) && (str.include? ' ') + (str.split SliceHintRx).map {|line| %(#{line}) }.join EOL + else + str + end + end + + def to_boolean val + val && val != 'false' && val.to_s != '0' || false + end + + ## + # These constants and functions are from the asciidictor-html5s project + # https://github.com/jirutka/asciidoctor-html5s/blob/a71db48a1dd5196b668b3a3d93693c5d877c5bf3/data/templates/helpers.rb + + # Defaults + DEFAULT_TOCLEVELS = 2 + DEFAULT_SECTNUMLEVELS = 3 + + + VOID_ELEMENTS = %w(area base br col command embed hr img input keygen link + meta param source track wbr) + + ## + # Creates an HTML tag with the given name and optionally attributes. Can take + # a block that will run between the opening and closing tags. + # + # @param name [#to_s] the name of the tag. + # @param attributes [Hash] (default: {}) + # @param content [#to_s] the content; +nil+ to call the block. (default: nil). + # @yield The block of Slim/HTML code within the tag (optional). + # @return [String] a rendered HTML element. + # + + def html_tag(name, attributes = {}, content = nil) + attrs = attributes.inject([]) do |attrs, (k, v)| + next attrs if !v || v.nil_or_empty? + v = v.compact.join(' ') if v.is_a? Array + attrs << (v == true ? k : %(#{k}="#{v}")) + end + attrs_str = attrs.empty? ? '' : attrs.join(' ').prepend(' ') + + + if VOID_ELEMENTS.include? name.to_s + %(<#{name}#{attrs_str}>) + else + content ||= yield if block_given? + %(<#{name}#{attrs_str}>#{content}) + end + end + + + ## + # Returns corrected section level. + # + # @param sec [Asciidoctor::Section] the section node (default: self). + # @return [Integer] + # + def section_level(sec = self) + @_section_level ||= (sec.level == 0 && sec.special) ? 1 : sec.level + end + + + ## + # Returns the captioned section's title, optionally numbered. + # + # @param sec [Asciidoctor::Section] the section node (default: self). + # @return [String] + # + def section_title(sec = self) + sectnumlevels = document.attr(:sectnumlevels, DEFAULT_SECTNUMLEVELS).to_i + + if sec.numbered && !sec.caption && sec.level <= sectnumlevels + [sec.sectnum, sec.captioned_title].join(' ') + else + sec.captioned_title + end + end + +end + +# More custom functions can be added in another namespace if required +#module Helpers +#end diff --git a/templates/slim/block_image.html.slim b/templates/image.html.slim similarity index 100% rename from templates/slim/block_image.html.slim rename to templates/image.html.slim diff --git a/templates/slim/inline_anchor.html.slim b/templates/inline_anchor.html.slim similarity index 100% rename from templates/slim/inline_anchor.html.slim rename to templates/inline_anchor.html.slim diff --git a/templates/slim/inline_break.html.slim b/templates/inline_break.html.slim similarity index 100% rename from templates/slim/inline_break.html.slim rename to templates/inline_break.html.slim diff --git a/templates/slim/inline_button.html.slim b/templates/inline_button.html.slim similarity index 100% rename from templates/slim/inline_button.html.slim rename to templates/inline_button.html.slim diff --git a/templates/slim/inline_callout.html.slim b/templates/inline_callout.html.slim similarity index 100% rename from templates/slim/inline_callout.html.slim rename to templates/inline_callout.html.slim diff --git a/templates/slim/inline_footnote.html.slim b/templates/inline_footnote.html.slim similarity index 100% rename from templates/slim/inline_footnote.html.slim rename to templates/inline_footnote.html.slim diff --git a/templates/slim/inline_image.html.slim b/templates/inline_image.html.slim similarity index 100% rename from templates/slim/inline_image.html.slim rename to templates/inline_image.html.slim diff --git a/templates/slim/inline_indexterm.html.slim b/templates/inline_indexterm.html.slim similarity index 100% rename from templates/slim/inline_indexterm.html.slim rename to templates/inline_indexterm.html.slim diff --git a/templates/slim/inline_kbd.html.slim b/templates/inline_kbd.html.slim similarity index 100% rename from templates/slim/inline_kbd.html.slim rename to templates/inline_kbd.html.slim diff --git a/templates/slim/inline_menu.html.slim b/templates/inline_menu.html.slim similarity index 100% rename from templates/slim/inline_menu.html.slim rename to templates/inline_menu.html.slim diff --git a/templates/slim/inline_quoted.html.slim b/templates/inline_quoted.html.slim similarity index 100% rename from templates/slim/inline_quoted.html.slim rename to templates/inline_quoted.html.slim diff --git a/templates/jade/admonition.jade b/templates/jade/admonition.jade deleted file mode 100644 index e73d6442..00000000 --- a/templates/jade/admonition.jade +++ /dev/null @@ -1,17 +0,0 @@ -if node['$has_role?']('aside') || node['$has_role?']('speaker') - aside.notes !{node.$content()} -else - div.admonitionblock(id=node.$id(),class=[node.$attr('name'), node.$role()]) - table - tr - td.icon - if node.document.$attr('icons') == 'font' - i(class="icon-#{node.$attr('name')}",title=node.$caption()) - else if node.document.$attr('icons', false) - img(src=node.$icon_uri(node.$attr('name')),alt=node.$caption()) - else - div.title - | !{node.$caption()} - if node.$title() != false - div.title !{node.$title()} - | !{node.$content()} diff --git a/templates/jade/audio.jade b/templates/jade/audio.jade deleted file mode 100644 index 88f86aa9..00000000 --- a/templates/jade/audio.jade +++ /dev/null @@ -1,6 +0,0 @@ -div.audioblock(id=node.$id(),class=[node.$style(), node.$role()]) - if node.$title() != false - div.title !{node.$captioned_title()} - div.content - audio(src=node.$media_uri(node.$attr('target')),autoplay=node.$option('autoplay', ""),controls=node.$option('nocontrols', ""),loop=node.$option('loop', "")) - | "Your browser does not support the audio tag." \ No newline at end of file diff --git a/templates/jade/colist.jade b/templates/jade/colist.jade deleted file mode 100644 index 9fa86e00..00000000 --- a/templates/jade/colist.jade +++ /dev/null @@ -1,22 +0,0 @@ -div.colist(id=node.$id(),class=[node.$style(), node.$role()]) - if node.$title() != false - div.title !{node.$title()} - if node.document.$attr("icons", false) - - font_icons = node.document.$attr("icons") == "font" - table - each item,i in node.$items() - - num = i + 1 - tr - td - if font_icons - i.conum(data-value=num) - b !{num} - else - img(src=node.$icon_uri("callouts/#{num}"),alt=num) - td !{item.$text()} - else - ol - each item in node.$items() - li - p - | !{item.$text()} diff --git a/templates/jade/dlist.jade b/templates/jade/dlist.jade deleted file mode 100644 index 8b4c4ed1..00000000 --- a/templates/jade/dlist.jade +++ /dev/null @@ -1,60 +0,0 @@ -if node.$style() == 'qanda' - div.qlist(id=node.$id(),class=['qanda', node.$role()]) - if node['$title?']() - .title= node.$title() - ol - each item, i in node.$items() - - questions = item[0] - - answer = item[1] - li - each question in [].concat(questions) - p - em= question.$text() - unless answer['$nil?']() - if answer['$text?']() - p= answer.$text() - if answer['$blocks?']() - | !{answer.$content()} -else if node.$style() == 'horizontal' - .hdlist(id=node.$id(),class=node.$role()) - if node['$title?']() - .title= node.$title() - table - if node['$attr?']('labelwidth') || node['$attr?']('itemwidth') - colgroup - col(width=node.$attr('labelwidth')) - col(width=node.$attr('itemwidth')) - each item in node.$items() - - var terms = item[0] - - var dd = item[1] - tr - td(class=['hdlist1', node['$option?']('strong') ? 'strong' : '']) - - terms = [].concat(terms) - - last_term = terms.$last() - each dt in terms - | !{dt.$text()} - if dt != last_term - br - td.hdlist2 - unless dd['$nil?']() - if dd['$text?']() - p= dd.$text() - if dd['$blocks?']() - | !{dd.$content()} -else - .dlist(id=node.$id(),class=[node.$style(), node.$role()]) - if node['$title?']() - .title= node.$title() - dl - each item in node.$items() - - terms = item[0] - - dd = item[1] - each dt in [].concat(terms) - dt(class=node.$style() == false ? 'hdlist1' : '') - | !{dt.$text()} - unless dd['$nil?']() - dd - if dd['$text?']() - p= dd.$text() - if dd['$blocks?']() - | !{dd.$content()} diff --git a/templates/jade/document.jade b/templates/jade/document.jade deleted file mode 100644 index cf3df34e..00000000 --- a/templates/jade/document.jade +++ /dev/null @@ -1,103 +0,0 @@ -doctype html -html(lang=node.document.$attr("lang", "en") ) - head - meta(charset="UTF-8") - - revealjsdir = node.$attr('revealjsdir', 'reveal.js') - each key in ["description","keywords","author","copyright"] - if node.$attr(key, false) - meta(name=key,content=node.$attr(key)) - title= node.$doctitle() - meta(content="yes",name="apple-mobile-web-app-capable") - meta(content="black-translucent",name="apple-mobile-web-app-status-bar-style") - meta(content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui",name="viewport") - link(href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css",rel="stylesheet") - link(href="#{revealjsdir}/css/reveal.css",rel="stylesheet") - if node.$attr("revealjs_customtheme", false) - link(rel='stylesheet',href="#{node.$attr('revealjs_customtheme')}",id='theme') - else - link(rel='stylesheet',href='#{revealjsdir}/css/theme/#{node.$attr("revealjs_theme", "black")}.css',id='theme') - link(href="#{revealjsdir}/lib/css/zenburn.css",rel="stylesheet") - script(src = "http://getfirebug.com/firebug-lite.js#startOpened=false") - script(type='text/javascript'). - document.write(''); - body - .reveal - .slides !{node.$content()} - script(src = "#{revealjsdir}/lib/js/head.min.js") - script(src = "#{revealjsdir}/js/reveal.js") - script(type='text/javascript'). - function initializeReveal() { - // See https://github.com/hakimel/reveal.js#configuration for a full list of configuration options - Reveal.initialize({ - // Display controls in the bottom right corner - controls: #{node.$attr('revealjs_controls', true)}, - // Display a presentation progress bar - progress: #{node.$attr('revealjs_progress', true) }, - // Display the page number of the current slide - slideNumber: #{node.$attr('revealjs_slidenumber', true) }, - // Push each slide change to the browser history - history: #{node.$attr('revealjs_history', true) }, - // Enable keyboard shortcuts for navigation - keyboard: #{node.$attr('revealjs_keyboard', true) }, - // Enable the slide overview mode - overview: #{node.$attr('revealjs_overview', true) }, - // Vertical centering of slides - center: #{node.$attr('revealjs_center', true) }, - // Enables touch navigation on devices with touch input - touch: #{node.$attr('revealjs_touch', true) }, - // Loop the presentation - loop: #{node.$attr('revealjs_loop', false) }, - // Change the presentation direction to be RTL - rtl: #{node.$attr('revealjs_rtl', false) }, - // Turns fragments on and off globally - fragments: #{node.$attr('revealjs_fragments', true) }, - // Flags if the presentation is running in an embedded mode, - // i.e. contained within a limited portion of the screen - embedded: #{node.$attr('revealjs_embedded', false) }, - // Number of milliseconds between automatically proceeding to the - // next slide, disabled when set to 0, this value can be overwritten - // by using a data-autoslide attribute on your slides - autoSlide: #{node.$attr('revealjs_autoslide', 0) }, - // Stop auto-sliding after user input - autoSlideStoppable: #{node.$attr('revealjs_autoslidestoppable', true) }, - // Enable slide navigation via mouse wheel - mouseWheel: #{node.$attr('revealjs_mousewheel', true) }, - // Hides the address bar on mobile devices - hideAddressBar: #{node.$attr('revealjs_hideaddressbar', true) }, - // Opens links in an iframe preview overlay - previewLinks: #{node.$attr('revealjs_previewlinks', false) }, - // Theme (e.g., beige, blond, default, moon, night, serif, simple, sky, solarized) - theme: Reveal.getQueryHash().theme || '#{node.$attr('revealjs_theme', 'serif') }', - // Transition style (e.g., default, cube, page, concave, zoom, linear, fade, none) - transition: Reveal.getQueryHash().transition || '#{node.$attr('revealjs_transition', 'default') }', - // Transition speed (e.g., default, fast, slow) - transitionSpeed: '#{node.$attr('revealjs_transitionspeed', 'default') }', - // Transition style for full page slide backgrounds (e.g., default, none, slide, concave, convex, zoom) - backgroundTransition: '#{node.$attr('revealjs_backgroundtransition', 'default') }', - // Number of slides away from the current that are visible - viewDistance: #{node.$attr('revealjs_viewdistance', 3)}, - // Parallax background image (e.g., "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'") - parallaxBackgroundImage: '#{node.$attr('revealjs_parallaxbackgroundimage', '') }', - // Parallax background size in CSS syntax (e.g., "2100px 900px") - parallaxBackgroundSize: '#{node.$attr('revealjs_parallaxbackgroundsize', '') }', - // Optional libraries used to extend on reveal.js - dependencies: [ - { - src: '#{revealjsdir}/lib/js/classList.js', - condition: function () { return !document.body.classList; } - }, - #{(node.$attr('source-highlighter') == 'highlight.js') ? "{ src: '#{revealjsdir}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }," : ""} - { - src: '#{revealjsdir}/plugin/zoom-js/zoom.js', - async: true, - condition: function () { return !!document.body.classList; } - }, - { - src: '#{revealjsdir}/plugin/notes/notes.js', - async: true, - condition: function () { return !!document.body.classList; } - } - ] - }); - } - initializeReveal(); diff --git a/templates/jade/embedded.jade b/templates/jade/embedded.jade deleted file mode 100644 index 95bcaed1..00000000 --- a/templates/jade/embedded.jade +++ /dev/null @@ -1,11 +0,0 @@ -unless node.$notitle() || !node['$has_header?']() - h1(id=node.$id()) !{node.$header().$title()} -| !{node.$content()} -unless !node['$footnotes?']() || node['$attr?']('nofootnotes') - div(id='footnotes') - hr - each fn in node.$footnotes() - div.footnote(id='_footnote_' + fn.$index()) - a(href='#_footnoteref_' + fn.$index()) - | !{fn.$index()} - | !{fn.$text()} diff --git a/templates/jade/example.jade b/templates/jade/example.jade deleted file mode 100644 index 9ec2cde4..00000000 --- a/templates/jade/example.jade +++ /dev/null @@ -1,4 +0,0 @@ -div.exampleblock(id=node.$id(),class=node.$role()) - if node.$title() != false - div.title !{node.$captioned_title()} - div.content !{node.$content()} diff --git a/templates/jade/floating_title.jade b/templates/jade/floating_title.jade deleted file mode 100644 index 7d0230b9..00000000 --- a/templates/jade/floating_title.jade +++ /dev/null @@ -1,2 +0,0 @@ -- levelPlusOne = level + 1 -#{"h#{levelPlusOne}"}(id=node.$id(),class=[node.$style(), node.$role()]) !{node.$title()} \ No newline at end of file diff --git a/templates/jade/image.jade b/templates/jade/image.jade deleted file mode 100644 index bbc3b9fa..00000000 --- a/templates/jade/image.jade +++ /dev/null @@ -1,12 +0,0 @@ -div.imageblock(id=node.$id(),class=["#{node.$style()}", "#{node.$role()}"],style={ - "text-align": node.$attr('align'), - float: node.$attr('float') ? "float: #{node.$attr('float')}" : '' -}) - .content - if node.$attr('link', false) - a.image(href=node.$attr('link')) - img(src=node.$image_uri(node.$attr('target')),alt=node.$attr('alt'),width=node.$attr('width'),height=node.$attr('height'),style=[node.$attr('background') ? "background: #{node.$attr('background')}" : ""]) - else - img(src=node.$image_uri(node.$attr('target')),alt=node.$attr('alt'),width=node.$attr('width'),height=node.$attr('height'),style=[node.$attr('background') ? "background: #{node.$attr('background')}" : ""]) - if node.$title() != false - .title !{node.$captioned_title()} diff --git a/templates/jade/inline_anchor.jade b/templates/jade/inline_anchor.jade deleted file mode 100644 index db3da9f7..00000000 --- a/templates/jade/inline_anchor.jade +++ /dev/null @@ -1,9 +0,0 @@ -case node.$type() - when "xref" - a(href=node.$target()) !{node.$text()} - when "ref" - a(id=node.$target()) - when "bibref" - a(id=node.$target()) - default - a(href=node.$target(),class=node.$role(),target=node.$attr('window')) !{node.$text()} diff --git a/templates/jade/inline_break.jade b/templates/jade/inline_break.jade deleted file mode 100644 index cd062146..00000000 --- a/templates/jade/inline_break.jade +++ /dev/null @@ -1,2 +0,0 @@ -| !{node.$text()} -br diff --git a/templates/jade/inline_button.jade b/templates/jade/inline_button.jade deleted file mode 100644 index 8f2ba892..00000000 --- a/templates/jade/inline_button.jade +++ /dev/null @@ -1 +0,0 @@ -b.button !{node.$text()} diff --git a/templates/jade/inline_callout.jade b/templates/jade/inline_callout.jade deleted file mode 100644 index 2000c85b..00000000 --- a/templates/jade/inline_callout.jade +++ /dev/null @@ -1,9 +0,0 @@ -if node.document.$attr("icons") == "font" - - num = "(" + node.$text() + ")" - i.conum(data-value=node.$text()) - b !{num} -else if node.document.$attr("icons", false) - img(src=node.$icon_uri("callouts/#{node.$text()}"),alt=node.$text()) -else - - num = "(" + node.$text() + ")" - b !{num} \ No newline at end of file diff --git a/templates/jade/inline_image.jade b/templates/jade/inline_image.jade deleted file mode 100644 index 8b974c57..00000000 --- a/templates/jade/inline_image.jade +++ /dev/null @@ -1,24 +0,0 @@ -span(class=[node.$type(), node.$role()],style=node.$attr('float', '')) - if node.$type() == 'icon' && node.document.$attr('icons') == 'font' - - style_class = ["fa fa-" + node.$target()] - - style_class.push(node['$attr?']('size') ? 'fa-' + node.$attr('size'): ''); - - style_class.push(node['$attr?']('rotate') ? 'fa-rotate-' + node.$attr('rotate'): ''); - - style_class.push(node['$attr?']('flip') ? 'fa-flip-' + node.$attr('flip'): ''); - if node['$attr?']('link') - a.image(href=node.$attr('link'),target=node.$attr('window')) - i(class=[style_class],title=node.$attr('title')) - else - i(class=[style_class],title=node.$attr('title')) - else if node.$type() == 'icon' && !node.document['$attr?']('icons') - if node['$attr?']('link') - a.image(href=node.$attr('link'),target=node.$attr('window')) - | [#{node.$attr('alt')}] - else - | [#{node.$attr('alt')}] - else - - src = node.$type() == 'icon' ? node.$icon_uri(node.$target()) : node.$image_uri(node.$target()) - if node['$attr?']('link') - a.image(href=node.$attr('link'),target=node.$attr('window')) - img(src=src,alt=node.$attr('link'),width=node.$attr('width'),height=node.$attr('height'),title=node.$attr('title')) - else - img(src=src,alt=node.$attr('link'),width=node.$attr('width'),height=node.$attr('height'),title=node.$attr('title')) \ No newline at end of file diff --git a/templates/jade/inline_indexterm.jade b/templates/jade/inline_indexterm.jade deleted file mode 100644 index b778b46f..00000000 --- a/templates/jade/inline_indexterm.jade +++ /dev/null @@ -1,2 +0,0 @@ -if node.$type() == "visible" - = !{node.$text()} \ No newline at end of file diff --git a/templates/jade/inline_kbd.jade b/templates/jade/inline_kbd.jade deleted file mode 100644 index 8c9d4318..00000000 --- a/templates/jade/inline_kbd.jade +++ /dev/null @@ -1,9 +0,0 @@ -- var keys = node.$attr('keys') -if keys.length == 1 - kbd !{keys.$first()} -else - kbd.keyseq - each key,idx in keys - if !idx['$zero?']() - | + - kbd !{key} \ No newline at end of file diff --git a/templates/jade/inline_quoted.jade b/templates/jade/inline_quoted.jade deleted file mode 100644 index 4fb22452..00000000 --- a/templates/jade/inline_quoted.jade +++ /dev/null @@ -1,26 +0,0 @@ -case node.$type() - when "emphasis" - em(class=node.$role()) !{node.$text()} - when "strong" - strong(class=node.$role()) !{node.$text()} - when "monospaced" - code(class=node.$role()) !{node.$text()} - when "superscript" - sup(class=node.$role()) !{node.$text()} - when "subscript" - sub(class=node.$role()) !{node.$text()} - when "double" - if node.$role() != false - span(class=node.$role()) “!{node.$text()}” - else - | “!{node.$text()}” - when "single" - if node.$role() != false - span(class=node.$role()) ‘!{node.$text()}’ - else - | ‘!{node.$text()}’ - default - if node.$role() != false - span(class=node.$role()) !{node.$text()} - else - | !{node.$text()} diff --git a/templates/jade/listing.jade b/templates/jade/listing.jade deleted file mode 100644 index dfede392..00000000 --- a/templates/jade/listing.jade +++ /dev/null @@ -1,29 +0,0 @@ -div.listingblock(id=node.$id(),class=node.$role()) - if node.$title() != false - div.title !{node.$captioned_title()} - div.content - - var nowrap = !(node.document.$attr("prewrap",false)) || node['$option?']('nowrap') - if node.$style() == "source" || (node.$style() == 'listing' && node.$attr(1, 'listing')) - - language = node.$attr('language',false) - - var code_class = language ? [language, "language-#{language}"] : "" - - var pre_class = ['highlight'] - - var pre_lang = "" - case node.$attr("source-highlighter") - when "coderay" - - pre_class = ['CodeRay'] - when 'pygments' - - pre_class = ['pygments','highlight'] - when 'prettify' - - pre_class = ['prettyprint'] - - pre_class.push(node.$attr("linenums",'')); - - pre_class.push(language ? language : ''); - - pre_class.push(language ? "language-#{language}" : ''); - when 'html-pipeline' - - pre_lang = language - - pre_class = code_class = '' - - nowrap = false - - pre_class.push(nowrap ? nowrap : '') - pre(class=pre_class,lang=pre_lang) - code(class=[code_class]) !{node.$content()} - else - pre(class=nowrap ? "nowrap" : "") !{node.$content()} \ No newline at end of file diff --git a/templates/jade/literal.jade b/templates/jade/literal.jade deleted file mode 100644 index 2f980d4d..00000000 --- a/templates/jade/literal.jade +++ /dev/null @@ -1,5 +0,0 @@ -div.literalblock(id=node.$id(),class=node.$role()) - if node.$title() != false - div.title !{node.$title()} - div.content - | !{node.$content()} diff --git a/templates/jade/olist.jade b/templates/jade/olist.jade deleted file mode 100644 index b93d1adb..00000000 --- a/templates/jade/olist.jade +++ /dev/null @@ -1,9 +0,0 @@ -div.olist(id=node.$id(),class=[node.$style(), node.$role()]) - if node['$title?']() - div.title !{node.$title()} - ol(class=node.$style(),start=node.$attr('start', ""),type=node.$list_marker_keyword()) - each item in node.$items() - li(class=[(node['$option?']('step') || node['$has_role?']('step')) ? "fragment" : ""]) - p !{item.$text()} - if item['$blocks?']() - | !{item.$content()} diff --git a/templates/jade/page_break.jade b/templates/jade/page_break.jade deleted file mode 100644 index db915c0a..00000000 --- a/templates/jade/page_break.jade +++ /dev/null @@ -1 +0,0 @@ -div(style="page-break-after: always;") diff --git a/templates/jade/paragraph.jade b/templates/jade/paragraph.jade deleted file mode 100644 index 985d8322..00000000 --- a/templates/jade/paragraph.jade +++ /dev/null @@ -1,7 +0,0 @@ -div.paragraph(id=node.$id(),class=node.$role()) - if node.$title() != false - div(class="title") !{node.$title()} - if node['$has_role?']('small') - small !{node.$content()} - else - p !{node.$content()} \ No newline at end of file diff --git a/templates/jade/pass.jade b/templates/jade/pass.jade deleted file mode 100644 index fa89430f..00000000 --- a/templates/jade/pass.jade +++ /dev/null @@ -1 +0,0 @@ -div !{node.$content()} diff --git a/templates/jade/quote.jade b/templates/jade/quote.jade deleted file mode 100644 index 815148df..00000000 --- a/templates/jade/quote.jade +++ /dev/null @@ -1,11 +0,0 @@ -div.quoteblock(id=node.$id(),class=node.$role()) - if node['$title?']() - div.title !{node.$title()} - blockquote !{node.$content()} - if node.$attr("attribution", false) || node.$attr("citetitle", false) - div.attribution - if node.$attr("citetitle", false) - cite !{node.$attr("citetitle")} - if node.$attr("attribution", false) && node.$attr("citetitle", false) - br - | — !{node.$attr("attribution", "")} \ No newline at end of file diff --git a/templates/jade/section.jade b/templates/jade/section.jade deleted file mode 100644 index b3371072..00000000 --- a/templates/jade/section.jade +++ /dev/null @@ -1,15 +0,0 @@ -- hide_title = false -if node.$level() == 1 - section - section(id=node.$id(),data-transition=node.$attr("data-transition", ""),data-transition-speed=node.$attr("data-transition-speed", ""),data-background=node.$attr("data-background", ""),data-background-size=node.$attr("data-background-size", ""),data-background-repeat=node.$attr("data-background-repeat", ""),data-background-transition=node.$attr("data-background-transition", "")) - if !hide_title - h2 !{node.$title()} - each block in (node.$blocks()['$-'](node.$sections())) - | !{block["$convert"]()} - each subsection in node.$sections() - | !{subsection["$convert"]()} -else - section(id=node.$id(),data-transition=(node.$attr('data-transition', "")),data-transition-speed=(node.$attr('data-transition-speed', "")),data-background=(node.$attr('data-background', "")),data-background-size=(node.$attr('data-background-size', "")),data-background-repeat=(node.$attr('data-background-repeat', "")),data-background-transition=(node.$attr('data-background-transition', ""))) - if !hide_title - h2 !{node.$title()} - | !{node.$content()} diff --git a/templates/jade/sidebar.jade b/templates/jade/sidebar.jade deleted file mode 100644 index bc343b81..00000000 --- a/templates/jade/sidebar.jade +++ /dev/null @@ -1,5 +0,0 @@ -.sidebarblock(id=node.$id(),class=node.$role()) - .content - if node.$title() != false - .title !{node.$title()} - | !{node.$content()} diff --git a/templates/jade/table.jade b/templates/jade/table.jade deleted file mode 100644 index 98135235..00000000 --- a/templates/jade/table.jade +++ /dev/null @@ -1,45 +0,0 @@ -table(id=node.$id(),class=["table-block", "frame-#{ node.$attr('frame', 'all') }", "frame-#{ node.$attr('grid', 'all') }", node.$role()]) - if node['$title?']() - caption.title !{node.$captioned_title()} - if node.$attr("rowcount") != 0 - colgroup - if node['$option?']('autowidth') - each ccc in node.$columns() - col - else - each col in node.$columns() - col(style={width: col.$attr("colpcwidth")}) - - tblsecs =["$head","$foot","$body"] - each tblsec in tblsecs - if node.$rows()[tblsec]().length != 0 - - var tag = "t" + tblsec.substr(1); - #{tag} - each row in node.$rows()[tblsec]() - tr - each cell in row - if tblsec == "$head" - - cell_content = cell.$text() - else - if cell.$style() == "verse" || cell.$style() == "literal" - - cell_content = cell.$text() - else - - cell_content = cell.$content() - #{tblsec == "$head" ? "th" : "td"}(class=['tableblock', "halign-#{cell.$attr('halign')}", "valign-#{cell.$attr('valign')}"], - colspan=cell.$colspan(), rowspan=cell.$rowspan(),style=node.document.$attr("cellbgcolor", false) ? "background-color:#{node.document.$attr('cellbgcolor')}" : "") - if tblsec == "$head" - | !{cell_content} - else - case cell.$style() - when "asciidoc" - div !{cell_content} - when "verse" - div.verse !{cell_content} - when "literal" - div.literal - pre !{cell_content} - when "header" - each text in cell_content - p.tableblock.header !{text} - default - each text in cell_content - p.tableblock !{text} diff --git a/templates/jade/ulist.jade b/templates/jade/ulist.jade deleted file mode 100644 index e079d3ed..00000000 --- a/templates/jade/ulist.jade +++ /dev/null @@ -1,25 +0,0 @@ -- checklist = node['$option?']('checklist') ? "checklist": null; -if checklist - if node['$option?']('interactive') - - marker_checked = '' - - marker_unchecked = '' - else - if node.document.$attr("icons") == "font" - - marker_checked = '' - - marker_unchecked = '' - else - - marker_checked = '' - - marker_unchecked = '' -div.ulist(id=id,class=[checklist, node.$style(), node.$role()]) - if node['$title?']() - div.title !{node.$title()} - ul(class=[checklist || node.$style()]) - each item in node.$items() - li(class=[(node['$option?']('step') || node['$has_role?']('step')) ? "fragment" : ""]) - p - if checklist && item.$attr('checkbox', false) - | !{item.$attr('checked') ? marker_checked : marker_unchecked}!{item.$text()} - else - | !{item.$text()} - if item['$blocks?']() - | !{item.$content()} diff --git a/templates/jade/verse.jade b/templates/jade/verse.jade deleted file mode 100644 index e11741a1..00000000 --- a/templates/jade/verse.jade +++ /dev/null @@ -1,14 +0,0 @@ -div.verseblock(id=node.$id(),class=node.$role()) - if node['$title()'] - div.title !{node.$title()} - pre.content !{node.$content()} - - attribution = node.$attr('attribution',null) - - citetitle = node.$attr('citetitle',null) - if attribution || citetitle - div.attribution - if citetitle - cite !{citetitle} - if attribution - if citetitle - br - | — #{attribution} \ No newline at end of file diff --git a/templates/jade/video.jade b/templates/jade/video.jade deleted file mode 100644 index f5e4e752..00000000 --- a/templates/jade/video.jade +++ /dev/null @@ -1,30 +0,0 @@ -div.videoblock(id=node.$id(),class=[node.$style(), node.$role()]) - if node['$title?']() - .title node.$captioned_title() - .content - case node.$attr('poster') - when "vimeo" - - start_anchor = node['$attr?']('start') ? "#at=" + node.$attr("start") : '' - - delimeter = "?" - - autoplay_param = node['$option?']('autoplay') ? delimeter + "autoplay=1" : '' - - delimeter = node['$option?']('autoplay') ? '&' : '' - - loop_param = node['$option?']('loop') ? delimeter + "loop=1" : '' - - src = "//player.vimeo.com/video/" + node.$attr('target') + start_anchor + autoplay_param + loop_param - iframe(width=node.$attr('width'),height=node.$attr('height'),src=src,frameborder=0,webkitAllowFullScreen=true,mozallowfullscreen=true,allowFullScreen=true) - when "youtube" - - amp = '&' - - params = ['rel=0'] - - params.push(node.$attr('start', false) ? (amp + "start=" + node.$attr('start')) : "") - - params.push(node.$attr('end', false) ? (amp + "end=" + node.$attr('end')) : "") - - params.push(node['$option?']('autoplay') ? amp + "autoplay=1" : "") - - params.push(node['$option?']('loop') ? (amp + "loop=1") : "") - - params.push(node['$option?']('nocontrols') ? (amp + "controls=0") : "") - - src = "//www.youtube.com/embed/" + node.$attr('target') + "/?" + params.join('') - iframe(width=node.$attr('width'),height=node.$attr('height'),src=src,frameborder=0,allowfullscreen=!node['$option?']('nofullscreen')) - default - video(src=node.$media_uri(node.$attr('target')),width=node.$attr('width'),height=node.$attr('height'), - poster=node.$attr('poster', false) ? node.$media_uri(node.$attr('poster')) : '', - autoplay=node['$option?']('autoplay'),controls=!node['$option?']('nocontrols'), - loop=node['$option?']('loop')) - | Your browser does not support the video tag. - diff --git a/templates/slim/block_listing.html.slim b/templates/listing.html.slim similarity index 100% rename from templates/slim/block_listing.html.slim rename to templates/listing.html.slim diff --git a/templates/slim/block_literal.html.slim b/templates/literal.html.slim similarity index 100% rename from templates/slim/block_literal.html.slim rename to templates/literal.html.slim diff --git a/templates/slim/block_olist.html.slim b/templates/olist.html.slim similarity index 100% rename from templates/slim/block_olist.html.slim rename to templates/olist.html.slim diff --git a/templates/slim/block_open.html.slim b/templates/open.html.slim similarity index 100% rename from templates/slim/block_open.html.slim rename to templates/open.html.slim diff --git a/templates/outline.html.slim b/templates/outline.html.slim new file mode 100644 index 00000000..970e5d02 --- /dev/null +++ b/templates/outline.html.slim @@ -0,0 +1,9 @@ +- unless sections.empty? + - toclevels ||= (document.attr 'toclevels', DEFAULT_TOCLEVELS).to_i + - slevel = section_level sections.first + ol class="sectlevel#{slevel}" + - sections.each do |sec| + li + a href="##{sec.id}" =section_title sec + - if (sec.level < toclevels) && (child_toc = converter.convert sec, 'outline') + = child_toc diff --git a/templates/slim/block_page_break.html.slim b/templates/page_break.html.slim similarity index 100% rename from templates/slim/block_page_break.html.slim rename to templates/page_break.html.slim diff --git a/templates/slim/block_paragraph.html.slim b/templates/paragraph.html.slim similarity index 100% rename from templates/slim/block_paragraph.html.slim rename to templates/paragraph.html.slim diff --git a/templates/slim/block_pass.html.slim b/templates/pass.html.slim similarity index 100% rename from templates/slim/block_pass.html.slim rename to templates/pass.html.slim diff --git a/templates/slim/block_preamble.html.slim b/templates/preamble.html.slim similarity index 100% rename from templates/slim/block_preamble.html.slim rename to templates/preamble.html.slim diff --git a/templates/slim/block_quote.html.slim b/templates/quote.html.slim similarity index 100% rename from templates/slim/block_quote.html.slim rename to templates/quote.html.slim diff --git a/templates/jade/ruler.jade b/templates/ruler.html.slim similarity index 100% rename from templates/jade/ruler.jade rename to templates/ruler.html.slim diff --git a/templates/slim/section.html.slim b/templates/section.html.slim similarity index 99% rename from templates/slim/section.html.slim rename to templates/section.html.slim index 36f2e409..40881015 100644 --- a/templates/slim/section.html.slim +++ b/templates/section.html.slim @@ -66,7 +66,7 @@ - else - if @level >= 3 / dynamic tags which maps with level - *{tag: %(h#{@level})} =title + h level=(@level) =title =content.chomp - else section(id=(titleless ? nil : _id) diff --git a/templates/slim/block_sidebar.html.slim b/templates/sidebar.html.slim similarity index 100% rename from templates/slim/block_sidebar.html.slim rename to templates/sidebar.html.slim diff --git a/templates/slim/block_floating_title.html.slim b/templates/slim/block_floating_title.html.slim deleted file mode 100644 index e8dd6505..00000000 --- a/templates/slim/block_floating_title.html.slim +++ /dev/null @@ -1 +0,0 @@ -*{:tag=>"h#{@level + 1}", :id=>@id, :class=>[@style,role].compact} =title diff --git a/templates/slim/block_ruler.html.slim b/templates/slim/block_ruler.html.slim deleted file mode 100644 index fcb5e9c6..00000000 --- a/templates/slim/block_ruler.html.slim +++ /dev/null @@ -1 +0,0 @@ -hr diff --git a/templates/slim/block_thematic_break.html.slim b/templates/slim/block_thematic_break.html.slim deleted file mode 100644 index fcb5e9c6..00000000 --- a/templates/slim/block_thematic_break.html.slim +++ /dev/null @@ -1 +0,0 @@ -hr diff --git a/templates/slim/helpers.rb b/templates/slim/helpers.rb deleted file mode 100644 index c95c9c94..00000000 --- a/templates/slim/helpers.rb +++ /dev/null @@ -1,38 +0,0 @@ -# This helper file borrows from the Bespoke converter -# https://github.com/asciidoctor/asciidoctor-bespoke -require 'asciidoctor' -require 'json' - -if Gem::Version.new(Asciidoctor::VERSION) <= Gem::Version.new('1.5.3') - fail 'asciidoctor: FAILED: reveal.js backend needs Asciidoctor >=1.5.4!' -end - -unless defined? Slim::Include - fail 'asciidoctor: FAILED: reveal.js backend needs Slim >= 2.1.0!' -end - -# This module gets mixed in to every node (the context of the template) at the -# time the node is being converted. The properties and methods in this module -# effectively become direct members of the template. -module Slim::Helpers - - EOL = %(\n) - SliceHintRx = / +/ - - def slice_text str, active = nil - if (active || (active.nil? && (option? :slice))) && (str.include? ' ') - (str.split SliceHintRx).map {|line| %(#{line}) }.join EOL - else - str - end - end - - def to_boolean val - val && val != 'false' && val.to_s != '0' || false - end - -end - -# More custom functions can be added in another namespace if required -#module Helpers -#end diff --git a/templates/slim/block_stem.html.slim b/templates/stem.html.slim similarity index 100% rename from templates/slim/block_stem.html.slim rename to templates/stem.html.slim diff --git a/templates/slim/block_table.html.slim b/templates/table.html.slim similarity index 83% rename from templates/slim/block_table.html.slim rename to templates/table.html.slim index dcd2d9f2..0bd2e6e5 100644 --- a/templates/slim/block_table.html.slim +++ b/templates/table.html.slim @@ -11,7 +11,8 @@ table(id=@id class=['tableblock',"frame-#{attr :frame, 'all'}","grid-#{attr :gri - @columns.each do |col| col style="width:#{col.attr :colpcwidth}%" - [:head, :foot, :body].select {|tblsec| !@rows[tblsec].empty? }.each do |tblsec| - *{:tag=>"t#{tblsec}"} + / not sure about this one, done when converting to a compilable slim template + - @rows[tblsec].each do |row| tr - row.each do |cell| @@ -24,9 +25,10 @@ table(id=@id class=['tableblock',"frame-#{attr :frame, 'all'}","grid-#{attr :gri - cell_content = cell.text - else - cell_content = cell.content - *{:tag=>(tblsec == :head ? 'th' : 'td'), :class=>['tableblock',"halign-#{cell.attr :halign}","valign-#{cell.attr :valign}"], + = html_tag(tblsec == :head || cell.style == :header ? 'th' : 'td', + :class=>['tableblock', "halign-#{cell.attr :halign}", "valign-#{cell.attr :valign}"], :colspan=>cell.colspan, :rowspan=>cell.rowspan, - :style=>((@document.attr? :cellbgcolor) ? %(background-color:#{@document.attr :cellbgcolor};) : nil)} + :style=>((@document.attr? :cellbgcolor) ? %(background-color:#{@document.attr :cellbgcolor};) : nil)) - if tblsec == :head =cell_content - else diff --git a/templates/jade/thematic_break.jade b/templates/thematic_break.html.slim similarity index 100% rename from templates/jade/thematic_break.jade rename to templates/thematic_break.html.slim diff --git a/templates/slim/block_toc.html.slim b/templates/toc.html.slim similarity index 100% rename from templates/slim/block_toc.html.slim rename to templates/toc.html.slim diff --git a/templates/slim/block_ulist.html.slim b/templates/ulist.html.slim similarity index 100% rename from templates/slim/block_ulist.html.slim rename to templates/ulist.html.slim diff --git a/templates/slim/block_verse.html.slim b/templates/verse.html.slim similarity index 100% rename from templates/slim/block_verse.html.slim rename to templates/verse.html.slim diff --git a/templates/slim/block_video.html.slim b/templates/video.html.slim similarity index 100% rename from templates/slim/block_video.html.slim rename to templates/video.html.slim diff --git a/test/output/slim/admonition.html b/test/doctest/admonition.html similarity index 100% rename from test/output/slim/admonition.html rename to test/doctest/admonition.html diff --git a/test/output/slim/audio.html b/test/doctest/audio.html similarity index 100% rename from test/output/slim/audio.html rename to test/doctest/audio.html diff --git a/test/output/slim/colist.html b/test/doctest/colist.html similarity index 100% rename from test/output/slim/colist.html rename to test/doctest/colist.html diff --git a/test/output/slim/concealed-slide-titles.html b/test/doctest/concealed-slide-titles.html similarity index 100% rename from test/output/slim/concealed-slide-titles.html rename to test/doctest/concealed-slide-titles.html diff --git a/test/output/slim/customcss.html b/test/doctest/customcss.html similarity index 100% rename from test/output/slim/customcss.html rename to test/doctest/customcss.html diff --git a/test/output/slim/data-background-newstyle.html b/test/doctest/data-background-newstyle.html similarity index 100% rename from test/output/slim/data-background-newstyle.html rename to test/doctest/data-background-newstyle.html diff --git a/test/output/slim/data-background-oldstyle.html b/test/doctest/data-background-oldstyle.html similarity index 100% rename from test/output/slim/data-background-oldstyle.html rename to test/doctest/data-background-oldstyle.html diff --git a/test/output/slim/dlist.html b/test/doctest/dlist.html similarity index 100% rename from test/output/slim/dlist.html rename to test/doctest/dlist.html diff --git a/test/output/slim/document.html b/test/doctest/document.html similarity index 100% rename from test/output/slim/document.html rename to test/doctest/document.html diff --git a/test/output/slim/embedded.html b/test/doctest/embedded.html similarity index 100% rename from test/output/slim/embedded.html rename to test/doctest/embedded.html diff --git a/test/output/slim/example.html b/test/doctest/example.html similarity index 100% rename from test/output/slim/example.html rename to test/doctest/example.html diff --git a/test/output/slim/floating_title.html b/test/doctest/floating_title.html similarity index 100% rename from test/output/slim/floating_title.html rename to test/doctest/floating_title.html diff --git a/test/output/slim/history-regression-tests.html b/test/doctest/history-regression-tests.html similarity index 100% rename from test/output/slim/history-regression-tests.html rename to test/doctest/history-regression-tests.html diff --git a/test/output/slim/history.html b/test/doctest/history.html similarity index 100% rename from test/output/slim/history.html rename to test/doctest/history.html diff --git a/test/output/slim/image.html b/test/doctest/image.html similarity index 100% rename from test/output/slim/image.html rename to test/doctest/image.html diff --git a/test/output/slim/images.html b/test/doctest/images.html similarity index 100% rename from test/output/slim/images.html rename to test/doctest/images.html diff --git a/test/output/slim/inline_anchor.html b/test/doctest/inline_anchor.html similarity index 100% rename from test/output/slim/inline_anchor.html rename to test/doctest/inline_anchor.html diff --git a/test/output/slim/inline_break.html b/test/doctest/inline_break.html similarity index 100% rename from test/output/slim/inline_break.html rename to test/doctest/inline_break.html diff --git a/test/output/slim/inline_button.html b/test/doctest/inline_button.html similarity index 100% rename from test/output/slim/inline_button.html rename to test/doctest/inline_button.html diff --git a/test/output/slim/inline_callout.html b/test/doctest/inline_callout.html similarity index 100% rename from test/output/slim/inline_callout.html rename to test/doctest/inline_callout.html diff --git a/test/output/slim/inline_footnote.html b/test/doctest/inline_footnote.html similarity index 100% rename from test/output/slim/inline_footnote.html rename to test/doctest/inline_footnote.html diff --git a/test/output/slim/inline_image.html b/test/doctest/inline_image.html similarity index 100% rename from test/output/slim/inline_image.html rename to test/doctest/inline_image.html diff --git a/test/output/slim/inline_kbd.html b/test/doctest/inline_kbd.html similarity index 100% rename from test/output/slim/inline_kbd.html rename to test/doctest/inline_kbd.html diff --git a/test/output/slim/inline_menu.html b/test/doctest/inline_menu.html similarity index 100% rename from test/output/slim/inline_menu.html rename to test/doctest/inline_menu.html diff --git a/test/output/slim/inline_quoted.html b/test/doctest/inline_quoted.html similarity index 100% rename from test/output/slim/inline_quoted.html rename to test/doctest/inline_quoted.html diff --git a/test/output/slim/keyboard-shortcuts.html b/test/doctest/keyboard-shortcuts.html similarity index 100% rename from test/output/slim/keyboard-shortcuts.html rename to test/doctest/keyboard-shortcuts.html diff --git a/test/output/slim/level-sections.html b/test/doctest/level-sections.html similarity index 100% rename from test/output/slim/level-sections.html rename to test/doctest/level-sections.html diff --git a/test/output/slim/listing.html b/test/doctest/listing.html similarity index 100% rename from test/output/slim/listing.html rename to test/doctest/listing.html diff --git a/test/output/slim/literal.html b/test/doctest/literal.html similarity index 100% rename from test/output/slim/literal.html rename to test/doctest/literal.html diff --git a/test/output/slim/multi-destination-content.html b/test/doctest/multi-destination-content.html similarity index 98% rename from test/output/slim/multi-destination-content.html rename to test/doctest/multi-destination-content.html index 9be5034f..fe2006ec 100644 --- a/test/output/slim/multi-destination-content.html +++ b/test/doctest/multi-destination-content.html @@ -40,6 +40,8 @@

Sub Section lvl 3

+ +

Some overview

@@ -64,6 +66,8 @@

Sub Section lvl 3

+-------------------------------------------------+ +
+

Detailed view

diff --git a/test/output/slim/olist.html b/test/doctest/olist.html similarity index 100% rename from test/output/slim/olist.html rename to test/doctest/olist.html diff --git a/test/output/slim/open.html b/test/doctest/open.html similarity index 100% rename from test/output/slim/open.html rename to test/doctest/open.html diff --git a/test/output/slim/outline.html b/test/doctest/outline.html similarity index 100% rename from test/output/slim/outline.html rename to test/doctest/outline.html diff --git a/test/output/slim/page_break.html b/test/doctest/page_break.html similarity index 100% rename from test/output/slim/page_break.html rename to test/doctest/page_break.html diff --git a/test/output/slim/paragraph.html b/test/doctest/paragraph.html similarity index 100% rename from test/output/slim/paragraph.html rename to test/doctest/paragraph.html diff --git a/test/output/slim/pass.html b/test/doctest/pass.html similarity index 100% rename from test/output/slim/pass.html rename to test/doctest/pass.html diff --git a/test/output/slim/preamble.html b/test/doctest/preamble.html similarity index 100% rename from test/output/slim/preamble.html rename to test/doctest/preamble.html diff --git a/test/output/slim/quote.html b/test/doctest/quote.html similarity index 100% rename from test/output/slim/quote.html rename to test/doctest/quote.html diff --git a/test/output/slim/revealjs-stretch.html b/test/doctest/revealjs-stretch.html similarity index 100% rename from test/output/slim/revealjs-stretch.html rename to test/doctest/revealjs-stretch.html diff --git a/test/output/slim/section.html b/test/doctest/section.html similarity index 100% rename from test/output/slim/section.html rename to test/doctest/section.html diff --git a/test/output/slim/sidebar.html b/test/doctest/sidebar.html similarity index 100% rename from test/output/slim/sidebar.html rename to test/doctest/sidebar.html diff --git a/test/output/slim/slide-state.html b/test/doctest/slide-state.html similarity index 100% rename from test/output/slim/slide-state.html rename to test/doctest/slide-state.html diff --git a/test/output/slim/source-callouts.html b/test/doctest/source-callouts.html similarity index 100% rename from test/output/slim/source-callouts.html rename to test/doctest/source-callouts.html diff --git a/test/output/slim/speaker-notes.html b/test/doctest/speaker-notes.html similarity index 100% rename from test/output/slim/speaker-notes.html rename to test/doctest/speaker-notes.html diff --git a/test/output/slim/stem.html b/test/doctest/stem.html similarity index 100% rename from test/output/slim/stem.html rename to test/doctest/stem.html diff --git a/test/output/slim/table.html b/test/doctest/table.html similarity index 99% rename from test/output/slim/table.html rename to test/doctest/table.html index bcf42848..18707352 100644 --- a/test/output/slim/table.html +++ b/test/doctest/table.html @@ -324,9 +324,9 @@

Emphasized text

- +

Styled like a header

- +
Literal block
diff --git a/test/output/slim/thematic_break.html b/test/doctest/thematic_break.html similarity index 100% rename from test/output/slim/thematic_break.html rename to test/doctest/thematic_break.html diff --git a/test/output/slim/title-preamble.html b/test/doctest/title-preamble.html similarity index 100% rename from test/output/slim/title-preamble.html rename to test/doctest/title-preamble.html diff --git a/test/output/slim/title-slide-color.html b/test/doctest/title-slide-color.html similarity index 100% rename from test/output/slim/title-slide-color.html rename to test/doctest/title-slide-color.html diff --git a/test/output/slim/title-slide-image.html b/test/doctest/title-slide-image.html similarity index 100% rename from test/output/slim/title-slide-image.html rename to test/doctest/title-slide-image.html diff --git a/test/output/slim/title-slide-video.html b/test/doctest/title-slide-video.html similarity index 100% rename from test/output/slim/title-slide-video.html rename to test/doctest/title-slide-video.html diff --git a/test/output/slim/title-subtitle-partitioning.html b/test/doctest/title-subtitle-partitioning.html similarity index 100% rename from test/output/slim/title-subtitle-partitioning.html rename to test/doctest/title-subtitle-partitioning.html diff --git a/test/output/slim/toc.html b/test/doctest/toc.html similarity index 54% rename from test/output/slim/toc.html rename to test/doctest/toc.html index 48e67c7b..33d66074 100644 --- a/test/output/slim/toc.html +++ b/test/doctest/toc.html @@ -3,7 +3,16 @@

Introduction

Table of Contents
- --TEMPLATE NOT FOUND--
+
    +
  1. Introduction
  2. +
  3. + The Ravages of Writing +
      +
    1. A Recipe for Potion
    2. +
    +
  4. +
+
@@ -19,7 +28,11 @@

A Recipe for Potion

Introduction

Table of Contents
- --TEMPLATE NOT FOUND--
+
    +
  1. Introduction
  2. +
  3. The Ravages of Writing
  4. +
+

The Ravages of Writing

@@ -30,7 +43,16 @@

The Ravages of Writing

Introduction

Table of Contents
- --TEMPLATE NOT FOUND--
+
    +
  1. Introduction
  2. +
  3. + The Ravages of Writing +
      +
    1. A Recipe for Potion
    2. +
    +
  4. +
+
@@ -46,7 +68,11 @@

A Recipe for Potion

Introduction

Table of Contents
- --TEMPLATE NOT FOUND--
+
    +
  1. Introduction
  2. +
  3. The Ravages of Writing
  4. +
+

The Ravages of Writing

diff --git a/test/output/slim/transitions.html b/test/doctest/transitions.html similarity index 100% rename from test/output/slim/transitions.html rename to test/doctest/transitions.html diff --git a/test/output/slim/ulist.html b/test/doctest/ulist.html similarity index 100% rename from test/output/slim/ulist.html rename to test/doctest/ulist.html diff --git a/test/output/slim/verse.html b/test/doctest/verse.html similarity index 100% rename from test/output/slim/verse.html rename to test/doctest/verse.html diff --git a/test/output/slim/vertical-slides.html b/test/doctest/vertical-slides.html similarity index 100% rename from test/output/slim/vertical-slides.html rename to test/doctest/vertical-slides.html diff --git a/test/output/slim/video.html b/test/doctest/video.html similarity index 100% rename from test/output/slim/video.html rename to test/doctest/video.html