reveal-ck 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -3
  3. data/bin/reveal-ck +2 -2
  4. data/features/step_definitions/html_match_steps.rb +27 -0
  5. data/files/reveal-ck/css/reveal-ck.css +6 -0
  6. data/{templates/reveal.js → files/reveal-ck/templates/index.html}/body.html.erb +0 -0
  7. data/{templates/reveal.js → files/reveal-ck/templates/index.html}/head.html.erb +2 -0
  8. data/{templates/reveal.js → files/reveal-ck/templates/index.html}/index.html.erb +0 -0
  9. data/{templates/reveal.js → files/reveal-ck/templates/index.html}/script.js.erb +0 -0
  10. data/{templates → files/reveal-ck/templates/slides}/code.slim +0 -0
  11. data/{templates → files/reveal-ck/templates/slides}/image.slim +0 -0
  12. data/{templates → files/reveal-ck/templates/slides}/intro.slim +0 -0
  13. data/{templates → files/reveal-ck/templates/slides}/quote.slim +0 -0
  14. data/{templates → files/reveal-ck/templates/slides}/text.slim +0 -0
  15. data/{reveal.js → files/reveal.js}/Gruntfile.js +0 -0
  16. data/{reveal.js → files/reveal.js}/LICENSE +0 -0
  17. data/{reveal.js → files/reveal.js}/README.md +0 -0
  18. data/{reveal.js → files/reveal.js}/css/print/paper.css +0 -0
  19. data/{reveal.js → files/reveal.js}/css/print/pdf.css +0 -0
  20. data/{reveal.js → files/reveal.js}/css/reveal.css +0 -0
  21. data/{reveal.js → files/reveal.js}/css/reveal.min.css +0 -0
  22. data/{reveal.js → files/reveal.js}/css/theme/README.md +0 -0
  23. data/{reveal.js → files/reveal.js}/css/theme/beige.css +0 -0
  24. data/{reveal.js → files/reveal.js}/css/theme/blood.css +0 -0
  25. data/{reveal.js → files/reveal.js}/css/theme/default.css +0 -0
  26. data/{reveal.js → files/reveal.js}/css/theme/moon.css +0 -0
  27. data/{reveal.js → files/reveal.js}/css/theme/night.css +0 -0
  28. data/{reveal.js → files/reveal.js}/css/theme/serif.css +0 -0
  29. data/{reveal.js → files/reveal.js}/css/theme/simple.css +0 -0
  30. data/{reveal.js → files/reveal.js}/css/theme/sky.css +0 -0
  31. data/{reveal.js → files/reveal.js}/css/theme/solarized.css +0 -0
  32. data/{reveal.js → files/reveal.js}/css/theme/source/beige.scss +0 -0
  33. data/{reveal.js → files/reveal.js}/css/theme/source/blood.scss +0 -0
  34. data/{reveal.js → files/reveal.js}/css/theme/source/default.scss +0 -0
  35. data/{reveal.js → files/reveal.js}/css/theme/source/moon.scss +0 -0
  36. data/{reveal.js → files/reveal.js}/css/theme/source/night.scss +0 -0
  37. data/{reveal.js → files/reveal.js}/css/theme/source/serif.scss +0 -0
  38. data/{reveal.js → files/reveal.js}/css/theme/source/simple.scss +0 -0
  39. data/{reveal.js → files/reveal.js}/css/theme/source/sky.scss +0 -0
  40. data/{reveal.js → files/reveal.js}/css/theme/source/solarized.scss +0 -0
  41. data/{reveal.js → files/reveal.js}/css/theme/template/mixins.scss +0 -0
  42. data/{reveal.js → files/reveal.js}/css/theme/template/settings.scss +0 -0
  43. data/{reveal.js → files/reveal.js}/css/theme/template/theme.scss +0 -0
  44. data/{reveal.js → files/reveal.js}/index.html +0 -0
  45. data/{reveal.js → files/reveal.js}/js/reveal.js +0 -0
  46. data/{reveal.js → files/reveal.js}/js/reveal.min.js +0 -0
  47. data/{reveal.js → files/reveal.js}/lib/css/zenburn.css +0 -0
  48. data/{reveal.js → files/reveal.js}/lib/font/league_gothic-webfont.eot +0 -0
  49. data/{reveal.js → files/reveal.js}/lib/font/league_gothic-webfont.svg +0 -0
  50. data/{reveal.js → files/reveal.js}/lib/font/league_gothic-webfont.ttf +0 -0
  51. data/{reveal.js → files/reveal.js}/lib/font/league_gothic-webfont.woff +0 -0
  52. data/{reveal.js → files/reveal.js}/lib/font/league_gothic_license +0 -0
  53. data/{reveal.js → files/reveal.js}/lib/js/classList.js +0 -0
  54. data/{reveal.js → files/reveal.js}/lib/js/head.min.js +0 -0
  55. data/{reveal.js → files/reveal.js}/lib/js/html5shiv.js +0 -0
  56. data/{reveal.js → files/reveal.js}/package.json +0 -0
  57. data/{reveal.js → files/reveal.js}/plugin/highlight/highlight.js +0 -0
  58. data/{reveal.js → files/reveal.js}/plugin/leap/leap.js +0 -0
  59. data/{reveal.js → files/reveal.js}/plugin/markdown/example.html +0 -0
  60. data/{reveal.js → files/reveal.js}/plugin/markdown/example.md +0 -0
  61. data/{reveal.js → files/reveal.js}/plugin/markdown/markdown.js +0 -0
  62. data/{reveal.js → files/reveal.js}/plugin/markdown/marked.js +0 -0
  63. data/{reveal.js → files/reveal.js}/plugin/math/math.js +0 -0
  64. data/{reveal.js → files/reveal.js}/plugin/multiplex/client.js +0 -0
  65. data/{reveal.js → files/reveal.js}/plugin/multiplex/index.js +0 -0
  66. data/{reveal.js → files/reveal.js}/plugin/multiplex/master.js +0 -0
  67. data/{reveal.js → files/reveal.js}/plugin/notes-server/client.js +0 -0
  68. data/{reveal.js → files/reveal.js}/plugin/notes-server/index.js +0 -0
  69. data/{reveal.js → files/reveal.js}/plugin/notes-server/notes.html +0 -0
  70. data/{reveal.js → files/reveal.js}/plugin/notes/notes.html +0 -0
  71. data/{reveal.js → files/reveal.js}/plugin/notes/notes.js +0 -0
  72. data/{reveal.js → files/reveal.js}/plugin/postmessage/example.html +0 -0
  73. data/{reveal.js → files/reveal.js}/plugin/postmessage/postmessage.js +0 -0
  74. data/{reveal.js → files/reveal.js}/plugin/print-pdf/print-pdf.js +0 -0
  75. data/{reveal.js → files/reveal.js}/plugin/remotes/remotes.js +0 -0
  76. data/{reveal.js → files/reveal.js}/plugin/search/search.js +0 -0
  77. data/{reveal.js → files/reveal.js}/plugin/zoom-js/zoom.js +0 -0
  78. data/{reveal.js → files/reveal.js}/test/examples/assets/image1.png +0 -0
  79. data/{reveal.js → files/reveal.js}/test/examples/assets/image2.png +0 -0
  80. data/{reveal.js → files/reveal.js}/test/examples/barebones.html +0 -0
  81. data/{reveal.js → files/reveal.js}/test/examples/embedded-media.html +0 -0
  82. data/{reveal.js → files/reveal.js}/test/examples/math.html +0 -0
  83. data/{reveal.js → files/reveal.js}/test/examples/slide-backgrounds.html +0 -0
  84. data/{reveal.js → files/reveal.js}/test/qunit-1.12.0.css +0 -0
  85. data/{reveal.js → files/reveal.js}/test/qunit-1.12.0.js +0 -0
  86. data/{reveal.js → files/reveal.js}/test/test-markdown-element-attributes.html +0 -0
  87. data/{reveal.js → files/reveal.js}/test/test-markdown-element-attributes.js +0 -0
  88. data/{reveal.js → files/reveal.js}/test/test-markdown-slide-attributes.html +0 -0
  89. data/{reveal.js → files/reveal.js}/test/test-markdown-slide-attributes.js +0 -0
  90. data/{reveal.js → files/reveal.js}/test/test-markdown.html +0 -0
  91. data/{reveal.js → files/reveal.js}/test/test-markdown.js +0 -0
  92. data/{reveal.js → files/reveal.js}/test/test.html +0 -0
  93. data/{reveal.js → files/reveal.js}/test/test.js +0 -0
  94. data/lib/reveal-ck.rb +9 -8
  95. data/lib/reveal-ck/builders.rb +1 -0
  96. data/lib/reveal-ck/builders/create_index_html.rb +3 -3
  97. data/lib/reveal-ck/builders/create_slides_html.rb +45 -3
  98. data/lib/reveal-ck/builders/index_html.rb +4 -4
  99. data/lib/reveal-ck/builders/reveal_ck_files.rb +21 -0
  100. data/lib/reveal-ck/builders/slides_builder.rb +26 -17
  101. data/lib/reveal-ck/config.rb +37 -14
  102. data/lib/reveal-ck/filtered_html_string.rb +24 -0
  103. data/lib/reveal-ck/markdown/slide_markdown.rb +11 -5
  104. data/lib/reveal-ck/render/index_html_maker.rb +9 -9
  105. data/lib/reveal-ck/templates/finder.rb +2 -1
  106. data/lib/reveal-ck/version.rb +1 -1
  107. data/spec/lib/reveal-ck/builders/copy_files_task_spec.rb +4 -4
  108. data/spec/lib/reveal-ck/builders/create_index_html_spec.rb +3 -2
  109. data/spec/lib/reveal-ck/builders/create_slides_html_spec.rb +26 -0
  110. data/spec/lib/reveal-ck/builders/index_html_spec.rb +4 -3
  111. data/spec/lib/reveal-ck/builders/slides_builder_spec.rb +2 -2
  112. data/spec/lib/reveal-ck/builders/user_files_spec.rb +1 -1
  113. data/spec/lib/reveal-ck/config_spec.rb +19 -1
  114. data/spec/lib/reveal-ck/markdown/slide_markdown_spec.rb +45 -42
  115. data/spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb +56 -14
  116. data/spec/lib/reveal-ck/templates/finder_spec.rb +5 -5
  117. data/spec/lib/reveal-ck/templates/processor_spec.rb +2 -2
  118. data/spec/lib/reveal-ck/tilt/config_spec.rb +1 -1
  119. data/spec/lib/reveal-ck_spec.rb +15 -14
  120. metadata +157 -110
  121. data/spec/data/changers/slicer/after_remove +0 -6
  122. data/spec/data/changers/slicer/before_remove +0 -10
  123. data/spec/data/changers/splicer/abcd +0 -4
  124. data/spec/data/changers/splicer/after_insert +0 -14
  125. data/spec/data/changers/splicer/before_insert +0 -10
  126. data/spec/data/changers/string_replacer/after_replace +0 -4
  127. data/spec/data/changers/string_replacer/before_replace +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f86a3c2fb07f07cc93f5ba5e78d505f0f3a94cd
4
- data.tar.gz: 5b9197c6a1fbd564ed20329357f879c60feeb246
3
+ metadata.gz: a22fa9bd00a93a29d756242fa3fca039c7a51ded
4
+ data.tar.gz: 9957dab823be1182634d4660df24a6b206d48a19
5
5
  SHA512:
6
- metadata.gz: 3cf370cd8cd3bf83b78cbc4f878c096579d32dad04098cda3754e18da67d11202f97182c6a927262028f9a89b32b4d87258ed5ee9a42ce0c4f10120191963ade
7
- data.tar.gz: b45e6ad9c6f594dc31905f3d314f48e469cdeb92e8e47589c0c8abe347ec50b6aa4e1105687f6dbee58bf5409b6084a45b7cced314c67dc489e443ba76db092a
6
+ metadata.gz: 7f73aa08506b27f0d1e16e3e8b32e1fee62415d3a9cf8ae332a7e989ec7302dea53cb54ac940eb014ff7073cfa07d2ba299575f78e09b744ca8fa2a89a99b928
7
+ data.tar.gz: bfdee99b08af09ab27de8aae8e8dae9a17c48c681acf73581ea5ab199a5b8be96256696e768e5c32439d5af876c126a6f14a09a46bd04f362dbca9e1b55008ba
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Make Slides with a Quickness
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/reveal-ck.svg)](http://badge.fury.io/rb/reveal-ck)
4
+
3
5
  reveal-ck lets you author [reveal.js][reveal.js] presentations with
4
6
  popular markup and templating languages.
5
7
 
@@ -29,7 +31,8 @@ You write in Markdown, Textile, Haml, Slim or Ruby itself.
29
31
  <img alt="Video Thumbnail" width="306" height="178" src='https://raw2.github.com/jedcn/reveal-ck/gh-pages/images/reveal-ck-stop-haml-time-thumbnail.png' />
30
32
  </a>
31
33
 
32
- [![Build Status][travis]](https://travis-ci.org/jedcn/reveal-ck)
33
- [![Code Climate][code-climate]](https://codeclimate.com/github/jedcn/reveal-ck)
34
34
 
35
- [reveal.js]: http://lab.hakim.se/reveal-js
35
+ [![Build Status](https://travis-ci.org/jedcn/reveal-ck.svg)](https://travis-ci.org/jedcn/reveal-ck)
36
+ [![Code Climate](https://codeclimate.com/github/jedcn/reveal-ck.png)](https://codeclimate.com/github/jedcn/reveal-ck)
37
+
38
+ [reveal.js]: http://lab.hakim.se/reveal-js
@@ -39,8 +39,8 @@ class RevealCKExecutable
39
39
  end
40
40
  puts "Generating slides for '#{slides_file}'.."
41
41
  builder_args = {
42
- reveal_js_dir: RevealCK.path_to('reveal.js'),
43
- reveal_ck_dir: Dir.pwd,
42
+ user_dir: Dir.pwd,
43
+ gem_dir: RevealCK.path,
44
44
  output_dir: options[:dir],
45
45
  slides_file: options[:file]
46
46
  }
@@ -0,0 +1,27 @@
1
+ require 'nokogiri'
2
+
3
+ def check_html_matches(file, selector_list, selector_type)
4
+ prep_for_fs_check do
5
+ content = IO.read(file)
6
+ doc = Nokogiri::HTML(content)
7
+ selector_list.each do |selector, description|
8
+ check_doc_matches(doc, selector, description, selector_type)
9
+ end
10
+ end
11
+ end
12
+
13
+ def check_doc_matches(doc, selector, description, type)
14
+ search_result = doc.send(type, selector)
15
+ return unless search_result.empty?
16
+ message = "Could not find #{description}. "
17
+ message += "No match for #{type} '#{selector}'"
18
+ fail message
19
+ end
20
+
21
+ Then(/^the file "(.*?)" should have html matching the css:$/) do |file, table|
22
+ check_html_matches(file, table.raw, :css)
23
+ end
24
+
25
+ Then(/^the file "(.*?)" should have html matching the xpath:$/) do |file, table|
26
+ check_html_matches(file, table.raw, :xpath)
27
+ end
@@ -0,0 +1,6 @@
1
+ .reveal section img.emoji {
2
+ background: none;
3
+ border: 0;
4
+ box-shadow: none;
5
+ margin: 0;
6
+ }
@@ -16,6 +16,8 @@
16
16
  <!-- For syntax highlighting -->
17
17
  <link rel="stylesheet" href="lib/css/zenburn.css">
18
18
 
19
+ <link rel="stylesheet" href="css/reveal-ck.css">
20
+
19
21
  <% css_files.each do |file| %>
20
22
  <link rel="stylesheet" href="<%= file %>">
21
23
  <% end %>
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  require_relative 'reveal-ck/version'
2
2
  require_relative 'reveal-ck/config'
3
3
  require_relative 'reveal-ck/retrieve'
4
+ require_relative 'reveal-ck/filtered_html_string'
4
5
  require_relative 'reveal-ck/render'
5
6
  require_relative 'reveal-ck/slide'
6
7
  require_relative 'reveal-ck/presentation'
@@ -10,20 +11,20 @@ require_relative 'reveal-ck/builders'
10
11
  require_relative 'reveal-ck/markdown'
11
12
  require_relative 'reveal-ck/tilt/config'
12
13
 
13
- # RevealCK::path_to provides the path where files within the reveal-ck
14
+ # RevealCK::path provides the path where files within the reveal-ck
14
15
  # gem are located on your system.
15
16
  module RevealCK
16
- def self.path_to(*args)
17
+ def self.path(*args)
17
18
  lib = File.dirname(__FILE__)
18
19
  gem_root = File.join(lib, '..')
19
20
  location = File.expand_path(gem_root)
20
21
  File.join(location, *args)
21
22
  end
22
- end
23
23
 
24
- # RevealCK::REVEALJS_FILES is a list of files that compromise
25
- # reveal.js bundled into this gem.
26
- module RevealCK
27
- revealjs = path_to('reveal.js')
28
- REVEALJS_FILES = Dir.glob("#{revealjs}/**/*")
24
+ def self.template_path(*args)
25
+ lib = File.dirname(__FILE__)
26
+ gem_root = File.join(lib, '..', 'files', 'reveal-ck', 'templates')
27
+ location = File.expand_path(gem_root)
28
+ File.join(location, *args)
29
+ end
29
30
  end
@@ -3,6 +3,7 @@ require_relative 'builders/creation_task'
3
3
  require_relative 'builders/copy_files_task'
4
4
  require_relative 'builders/slides_builder'
5
5
  require_relative 'builders/reveal_js_files'
6
+ require_relative 'builders/reveal_ck_files'
6
7
  require_relative 'builders/create_slides_html'
7
8
  require_relative 'builders/create_index_html'
8
9
  require_relative 'builders/user_files'
@@ -7,11 +7,11 @@ module RevealCK
7
7
  # index.html file should end up, this class knows how to work with
8
8
  # Rake and create the index.html.
9
9
  class CreateIndexHtml < CreationTask
10
- attr_reader :slides_html, :index_html, :output_dir, :config
10
+ attr_reader :slides_html, :template, :output_dir, :config
11
11
 
12
12
  def initialize(args)
13
13
  @slides_html = retrieve(:slides_html, args)
14
- @index_html = retrieve(:index_html, args)
14
+ @template = retrieve(:template, args)
15
15
  @output_dir = retrieve(:output_dir, args)
16
16
  @config = retrieve(:config, args)
17
17
  super
@@ -21,7 +21,7 @@ module RevealCK
21
21
  index_html_file = "#{output_dir}/index.html"
22
22
  task(index_html_file => slides_html) do
23
23
  content = IndexHtml.new(slides_html: slides_html,
24
- index_file: index_html,
24
+ template: template,
25
25
  config: config).render
26
26
  File.open(index_html_file, 'w') do |index_html|
27
27
  index_html.puts(content)
@@ -1,3 +1,5 @@
1
+ require 'html/pipeline'
2
+
1
3
  module RevealCK
2
4
  module Builders
3
5
  # Given a slides_file, a Rake application, and a place where the
@@ -16,14 +18,54 @@ module RevealCK
16
18
  def setup
17
19
  slides_html_file = "#{output_dir}/slides.html"
18
20
  task(slides_html_file) do
19
- presentation = RevealCK::Presentation.load(file: slides_file,
20
- config: config)
21
21
  File.open(slides_html_file, 'w') do |slides_html|
22
- slides_html.puts(presentation.html)
22
+ slides_html.puts(presentation_html)
23
23
  end
24
24
  end
25
25
  things_to_create.add(slides_html_file)
26
26
  end
27
+
28
+ private
29
+
30
+ def presentation_html
31
+ presentation = RevealCK::Presentation.load(file: slides_file,
32
+ config: config)
33
+ initial_html = presentation.html
34
+ apply_filters_to(initial_html)
35
+ end
36
+
37
+ def apply_filters_to(html)
38
+ filters = get_classes_from_array(config.filters)
39
+ pipeline = HTML::Pipeline.new(filters)
40
+ filtered_html_string = FilteredHtmlString.new(html: html,
41
+ config: config.to_h,
42
+ pipeline: pipeline)
43
+ filtered_html_string.render
44
+ end
45
+
46
+ def get_classes_from_array(array_of_names)
47
+ array_of_names.map do |name|
48
+ name.split('::').reduce(Object) { |a, e| a.const_get(e) }
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ module HTML
56
+ class Pipeline
57
+ # This class is very similar EmojiFilter. It has been slightly
58
+ # tweaked to make emoji function better within reveal.js
59
+ class RevealCKEmojiFilter < EmojiFilter
60
+ def emoji_image_filter(text)
61
+ return text unless text.include?(':')
62
+
63
+ text.gsub EmojiPattern do
64
+ name = Regexp.last_match[1]
65
+ result = "<img class='emoji' title=':#{name}:' alt=':#{name}:'"
66
+ result + "src='#{emoji_url(name)}' align='absmiddle' />"
67
+ end
68
+ end
27
69
  end
28
70
  end
29
71
  end
@@ -9,21 +9,21 @@ module RevealCK
9
9
  class IndexHtml
10
10
  include Retrieve
11
11
 
12
- attr_reader :index_file, :slides_html, :config
12
+ attr_reader :template, :slides_html, :config
13
13
 
14
14
  def initialize(args)
15
- @index_file = retrieve(:index_file, args)
15
+ @template = retrieve(:template, args)
16
16
  @slides_html = retrieve(:slides_html, args)
17
17
  @config = retrieve(:config, args)
18
18
  end
19
19
 
20
20
  def render
21
21
  scope = RevealCK::Render::Scope.new(dir: Dir.pwd, config: config)
22
- template = Tilt.new(index_file)
22
+ tilt_template = Tilt.new(template)
23
23
  locals = {
24
24
  slides_html: slides_html
25
25
  }
26
- template.render(scope, locals)
26
+ tilt_template.render(scope, locals)
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,21 @@
1
+ require 'rake'
2
+
3
+ module RevealCK
4
+ module Builders
5
+ # This class knows which files from reveal-ck are vital to the
6
+ # presentation.
7
+ class RevealCkFiles
8
+ include Retrieve
9
+
10
+ attr_reader :dir
11
+
12
+ def initialize(args)
13
+ @dir = retrieve(:dir, args)
14
+ end
15
+
16
+ def files
17
+ FileList["#{dir}/css/reveal-ck.css"]
18
+ end
19
+ end
20
+ end
21
+ end