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
@@ -7,12 +7,13 @@ module RevealCK
7
7
  # file to work with, and a place to put it all.. this class
8
8
  # creates a presentation.
9
9
  class SlidesBuilder < CreationTask
10
- attr_reader :reveal_js_dir, :reveal_ck_dir
10
+ attr_reader :user_dir, :gem_dir, :reveal_js_dir
11
11
  attr_reader :slides_file, :output_dir
12
12
  attr_reader :application
13
13
  def initialize(args)
14
- @reveal_js_dir = retrieve(:reveal_js_dir, args)
15
- @reveal_ck_dir = retrieve(:reveal_ck_dir, args)
14
+ @user_dir = retrieve(:user_dir, args)
15
+ @gem_dir = retrieve(:gem_dir, args)
16
+ @reveal_js_dir = File.join(gem_dir, 'files', 'reveal.js')
16
17
  @output_dir = retrieve(:output_dir, args)
17
18
  @slides_file = retrieve(:slides_file, args)
18
19
  @application = Rake::Application.new
@@ -32,7 +33,7 @@ module RevealCK
32
33
  end
33
34
 
34
35
  def read_config
35
- config_file = File.join(reveal_ck_dir, 'config.yml')
36
+ config_file = File.join(user_dir, 'config.yml')
36
37
  return unless File.exist?(config_file)
37
38
  config_as_hash = YAML.load_file config_file
38
39
  @config.merge!(config_as_hash)
@@ -40,25 +41,33 @@ module RevealCK
40
41
 
41
42
  def dependencies
42
43
  [copy_user_files,
43
- copy_reveal_js,
44
+ copy_reveal_ck_files,
45
+ copy_reveal_js_files,
44
46
  create_slides_html,
45
47
  create_index_html]
46
48
  end
47
49
 
48
- def copy_user_files
49
- file_listing = UserFiles.new(dir: reveal_ck_dir)
50
+ def copy_files(file_listing)
50
51
  task = CopyFilesTask.new(file_listing: file_listing,
51
52
  output_dir: output_dir,
52
53
  application: application)
53
54
  task.prepare
54
55
  end
55
56
 
56
- def copy_reveal_js
57
- file_listing = RevealJsFiles.new(dir: reveal_js_dir)
58
- task = CopyFilesTask.new(file_listing: file_listing,
59
- output_dir: output_dir,
60
- application: application)
61
- task.prepare
57
+ def copy_user_files
58
+ user_files = UserFiles.new(dir: user_dir)
59
+ copy_files(user_files)
60
+ end
61
+
62
+ def copy_reveal_ck_files
63
+ reveal_ck_files_dir = File.join(gem_dir, 'files', 'reveal-ck')
64
+ reveal_ck_files = RevealCkFiles.new(dir: reveal_ck_files_dir)
65
+ copy_files(reveal_ck_files)
66
+ end
67
+
68
+ def copy_reveal_js_files
69
+ reveal_js_files = RevealJsFiles.new(dir: reveal_js_dir)
70
+ copy_files(reveal_js_files)
62
71
  end
63
72
 
64
73
  def create_slides_html
@@ -71,12 +80,12 @@ module RevealCK
71
80
  end
72
81
 
73
82
  def create_index_html
74
- index_html_erb = RevealCK.path_to('templates',
75
- 'reveal.js',
76
- 'index.html.erb')
83
+ index_html_erb =
84
+ RevealCK.template_path('index.html',
85
+ 'index.html.erb')
77
86
  task =
78
87
  CreateIndexHtml.new(slides_html: "#{output_dir}/slides.html",
79
- index_html: index_html_erb,
88
+ template: index_html_erb,
80
89
  output_dir: output_dir,
81
90
  config: @config,
82
91
  application: application)
@@ -6,7 +6,7 @@ module RevealCK
6
6
  # reveal-ck. It has defaults. It is mutable.
7
7
  class Config < OpenStruct
8
8
  def initialize
9
- super DEFAULTS
9
+ super defaults
10
10
  end
11
11
 
12
12
  def merge!(hash)
@@ -15,20 +15,43 @@ module RevealCK
15
15
  end
16
16
  end
17
17
 
18
- DEFAULTS = {
19
- 'title' => 'Slides',
20
- 'author' => '',
21
- 'theme' => 'default',
22
- 'transition' => 'default',
23
- 'revealjs_config' => {
24
- 'controls' => true,
25
- 'progress' => true,
26
- 'history' => true,
27
- 'center' => true
28
- },
29
- 'data' => {
18
+ def defaults
19
+ [core_defaults,
20
+ revealjs_config_defaults,
21
+ filter_defaults].reduce({}) { |a, e| a.merge(e) }
22
+ end
23
+
24
+ def core_defaults
25
+ {
26
+ 'title' => 'Slides',
27
+ 'author' => '',
28
+ 'theme' => 'default',
29
+ 'transition' => 'default',
30
+ 'data' => {
31
+
32
+ }
33
+ }
34
+ end
30
35
 
36
+ def revealjs_config_defaults
37
+ {
38
+ 'revealjs_config' => {
39
+ 'controls' => true,
40
+ 'progress' => true,
41
+ 'history' => true,
42
+ 'center' => true
43
+ }
31
44
  }
32
- }
45
+ end
46
+
47
+ def filter_defaults
48
+ {
49
+ 'filters' => ['HTML::Pipeline::RevealCKEmojiFilter',
50
+ 'HTML::Pipeline::MentionFilter',
51
+ 'HTML::Pipeline::AutolinkFilter'],
52
+ 'asset_root' => 'https://assets-cdn.github.com/images/icons/',
53
+ 'base_url' => 'https://github.com'
54
+ }
55
+ end
33
56
  end
34
57
  end
@@ -0,0 +1,24 @@
1
+ module RevealCK
2
+ # Enables easy filtering of an HTML string through an html-pipeline.
3
+ class FilteredHtmlString
4
+ include Retrieve
5
+ attr_reader :html, :pipeline, :config
6
+
7
+ def initialize(args)
8
+ @html = retrieve(:html, args)
9
+ @pipeline = retrieve(:pipeline, args)
10
+ @config = retrieve(:config, args)
11
+ end
12
+
13
+ def render
14
+ apply_pipeline(pipeline, config).to_s
15
+ end
16
+
17
+ private
18
+
19
+ def apply_pipeline(pipeline, config)
20
+ result = pipeline.call(html, config)
21
+ result[:output]
22
+ end
23
+ end
24
+ end
@@ -2,11 +2,7 @@ require 'redcarpet'
2
2
 
3
3
  module RevealCK
4
4
  module Markdown
5
- #
6
- # Public: This class defines what "Slide Markdown" is: an
7
- # extension of regular Redcarpet Markdown with some basic post
8
- # processing.
9
- #
5
+ # This class defines what "Slide Markdown" is.
10
6
  class SlideMarkdown < Redcarpet::Render::HTML
11
7
  HR = '<hr>'
12
8
  HR_NEWLINE = "<hr>\n"
@@ -24,6 +20,16 @@ module RevealCK
24
20
  doc = doc.gsub(HR, SLIDE_DIVIDER)
25
21
  "#{SLIDE_START}\n#{doc}\n#{SLIDE_END}"
26
22
  end
23
+
24
+ def block_code(code, language)
25
+ if language.nil?
26
+ "<pre><code>#{code}</code></pre>"
27
+ elsif language == 'notes' || language == 'note'
28
+ "<aside class='notes'>#{code}</aside>"
29
+ else
30
+ "<pre><code class=\"#{language}\">#{code}</code></pre>"
31
+ end
32
+ end
27
33
  end
28
34
  end
29
35
  end
@@ -5,17 +5,17 @@ module RevealCK
5
5
  # An IndexHtml is made by composed head, body, and script.
6
6
  module IndexHtmlMaker
7
7
  def head
8
- head_html_erb = RevealCK.path_to('templates',
9
- 'reveal.js',
10
- 'head.html.erb')
8
+ head_html_erb =
9
+ RevealCK.template_path('index.html',
10
+ 'head.html.erb')
11
11
  template = Tilt.new(head_html_erb)
12
12
  template.render(self)
13
13
  end
14
14
 
15
15
  def body(slides_html)
16
- body_html_erb = RevealCK.path_to('templates',
17
- 'reveal.js',
18
- 'body.html.erb')
16
+ body_html_erb =
17
+ RevealCK.template_path('index.html',
18
+ 'body.html.erb')
19
19
  template = Tilt.new(body_html_erb)
20
20
  locals = {
21
21
  slides_html: slides_html
@@ -24,9 +24,9 @@ module RevealCK
24
24
  end
25
25
 
26
26
  def script
27
- script_js_erb = RevealCK.path_to('templates',
28
- 'reveal.js',
29
- 'script.js.erb')
27
+ script_js_erb =
28
+ RevealCK.template_path('index.html',
29
+ 'script.js.erb')
30
30
  template = Tilt.new(script_js_erb)
31
31
  template.render(self)
32
32
  end
@@ -15,7 +15,8 @@ module RevealCK
15
15
 
16
16
  def default_paths
17
17
  pwd_templates = File.join Dir.pwd, 'templates'
18
- reveal_ck_templates = RevealCK.path_to 'templates'
18
+ reveal_ck_templates =
19
+ RevealCK.template_path('slides')
19
20
  [pwd_templates, reveal_ck_templates]
20
21
  end
21
22
 
@@ -1,4 +1,4 @@
1
1
  # RevealCK::VERSION is the current version of reveal-ck
2
2
  module RevealCK
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
@@ -18,12 +18,12 @@ module RevealCK
18
18
  let :file_listing do
19
19
  file_listing = double
20
20
 
21
- file_listing
22
- .stub(:files)
21
+ allow(file_listing)
22
+ .to receive(:files)
23
23
  .and_return([file_a_source, file_b_source])
24
24
 
25
- file_listing
26
- .stub(:dir)
25
+ allow(file_listing)
26
+ .to receive(:dir)
27
27
  .and_return(source_dir)
28
28
 
29
29
  file_listing
@@ -17,12 +17,13 @@ module RevealCK
17
17
  end
18
18
 
19
19
  index_html_erb =
20
- RevealCK.path_to('templates/reveal.js/index.html.erb')
20
+ RevealCK.template_path('index.html',
21
+ 'index.html.erb')
21
22
 
22
23
  application = Rake::Application.new
23
24
  create_index_html =
24
25
  CreateIndexHtml.new(slides_html: slides_html,
25
- index_html: index_html_erb,
26
+ template: index_html_erb,
26
27
  output_dir: dir,
27
28
  config: Config.new,
28
29
  application: application)
@@ -30,6 +30,32 @@ module RevealCK
30
30
  end
31
31
  end
32
32
  end
33
+
34
+ it 'can transform emoji' do
35
+ Dir.mktmpdir do |dir|
36
+ Dir.chdir(dir) do
37
+
38
+ slides_file_initial = 'slides-initial.md'
39
+ File.open(slides_file_initial, 'w') do |file|
40
+ file.puts('# I :heart: Slides')
41
+ end
42
+
43
+ config = Config.new
44
+ config.filters = ['HTML::Pipeline::RevealCKEmojiFilter']
45
+ application = Rake::Application.new
46
+ slides_html =
47
+ CreateSlidesHtml.new(slides_file: slides_file_initial,
48
+ output_dir: dir,
49
+ config: config,
50
+ application: application)
51
+
52
+ slides_html.prepare
53
+ application['create_slides_html'].invoke
54
+ content = File.open('slides.html', 'r').read
55
+ expect(content).to include 'emoji/heart.png'
56
+ end
57
+ end
58
+ end
33
59
  end
34
60
  end
35
61
  end
@@ -4,7 +4,8 @@ module RevealCK
4
4
  module Builders
5
5
  describe IndexHtml do
6
6
  let :index_html_erb do
7
- File.join(Dir.pwd, 'templates', 'reveal.js', 'index.html.erb')
7
+ RevealCK.template_path('index.html',
8
+ 'index.html.erb')
8
9
  end
9
10
 
10
11
  let :slides_html do
@@ -21,7 +22,7 @@ module RevealCK
21
22
  end
22
23
 
23
24
  let :index_html do
24
- IndexHtml.new(index_file: index_html_erb,
25
+ IndexHtml.new(template: index_html_erb,
25
26
  slides_html: slides_html,
26
27
  config: config)
27
28
  end
@@ -31,7 +32,7 @@ module RevealCK
31
32
  end
32
33
 
33
34
  it 'is created with a file location and a config' do
34
- expect(index_html.index_file).to include 'index.html.erb'
35
+ expect(index_html.template).to include 'index.html.erb'
35
36
  expect(index_html.config.title).to eq config.title
36
37
  end
37
38
 
@@ -24,8 +24,8 @@ module RevealCK
24
24
  end
25
25
 
26
26
  args = {
27
- reveal_js_dir: RevealCK.path_to('reveal.js'),
28
- reveal_ck_dir: dir,
27
+ user_dir: dir,
28
+ gem_dir: RevealCK.path,
29
29
  output_dir: 'presentation',
30
30
  slides_file: slides_file
31
31
  }
@@ -5,7 +5,7 @@ module RevealCK
5
5
  describe UserFiles do
6
6
  describe '#all' do
7
7
  let :stand_in_user_files_dir do
8
- File.join(Dir.pwd, 'reveal.js')
8
+ File.join(Dir.pwd, 'files', 'reveal.js')
9
9
  end
10
10
 
11
11
  let :user_files do
@@ -40,10 +40,28 @@ module RevealCK
40
40
  expect(config.transition).to eq 'default'
41
41
  end
42
42
 
43
- it 'supplies an #transition, and #transition=' do
43
+ it 'supplies a #transition, and #transition=' do
44
44
  config.transition = 'page'
45
45
  expect(config.transition).to eq 'page'
46
46
  end
47
+
48
+ it 'supplies a default asset_root' do
49
+ expect(config.asset_root)
50
+ .to eq 'https://assets-cdn.github.com/images/icons/'
51
+ end
52
+
53
+ it 'supplies a default list of filters' do
54
+ expect(config.filters).to eq ['HTML::Pipeline::RevealCKEmojiFilter',
55
+ 'HTML::Pipeline::MentionFilter',
56
+ 'HTML::Pipeline::AutolinkFilter']
57
+ end
58
+
59
+ it 'does not share attributes between instances' do
60
+ first = Config.new
61
+ first.filters << 'A'
62
+ second = Config.new
63
+ expect(second.filters).to_not include 'A'
64
+ end
47
65
  end
48
66
 
49
67
  describe 'revealjs_config options' do
@@ -8,67 +8,70 @@ module RevealCK
8
8
  SlideMarkdown.new
9
9
  end
10
10
 
11
- let :basic_input do
12
- <<-eos
13
- <h1>First Slide</h1>
11
+ describe '#postprocess' do
12
+ let :basic_input do
13
+ <<-eos
14
+ <h1>h1 Slide</h1>
14
15
 
15
16
  <hr>
16
17
 
17
- <h1>Second Slide</h1>
18
+ <h2>h2 Slide</h2>
18
19
  eos
19
- end
20
+ end
20
21
 
21
- let :leading_hr_input do
22
- <<-eos
22
+ let :leading_hr_input do
23
+ <<-eos
23
24
  <hr>
24
25
 
25
- <h1>First Slide</h1>
26
+ <h1>h1 Slide</h1>
26
27
 
27
28
  <hr>
28
29
 
29
- <h1>Second Slide</h1>
30
+ <h2>h2 Slide</h2>
30
31
  eos
31
- end
32
+ end
32
33
 
33
- let :trailing_hr_input do
34
- <<-eos
35
- <h1>First Slide</h1>
34
+ let :trailing_hr_input do
35
+ <<-eos
36
+ <h1>h1 Slide</h1>
36
37
 
37
38
  <hr>
38
39
 
39
- <h1>Second Slide</h1>
40
+ <h2>h2 Slide</h2>
40
41
 
41
42
  <hr>
42
43
  eos
44
+ end
45
+
46
+ it 'wraps its content in a <section>"' do
47
+ output = slide_markdown.postprocess(basic_input)
48
+ expect(output).to start_with '<section>'
49
+ expect(output).to end_with '</section>'
50
+ expect(output.scan('<section>').size).to eq 2
51
+ expect(output.scan('</section>').size).to eq 2
52
+ end
53
+
54
+ it 'replaces <hr> with section breaks' do
55
+ output = slide_markdown.postprocess(basic_input)
56
+ expect(output).to_not include 'hr'
57
+ expect(output).to include '<h1>h1 Slide</h1>'
58
+ expect(output).to include '<h2>h2 Slide</h2>'
59
+ end
60
+
61
+ it 'does not turn an initial <hr> into a section' do
62
+ output = slide_markdown.postprocess(leading_hr_input)
63
+ expect(output.scan('<section>').size).to eq 2
64
+ expect(output.scan('</section>').size).to eq 2
65
+ expect(output).to_not include 'hr'
66
+ end
67
+
68
+ it 'does not turn a trailing <hr> into a section' do
69
+ output = slide_markdown.postprocess(trailing_hr_input)
70
+ expect(output.scan('<section>').size).to eq 2
71
+ expect(output.scan('</section>').size).to eq 2
72
+ expect(output).to_not include 'hr'
73
+ end
43
74
  end
44
-
45
- it 'prepends an opening "<section>"' do
46
- output = slide_markdown.postprocess(basic_input)
47
- output.should start_with '<section>'
48
- end
49
-
50
- it 'appends a closing "</section>"' do
51
- output = slide_markdown.postprocess(basic_input)
52
- output.should end_with '</section>'
53
- end
54
-
55
- it 'replaces "<hr>"s with section breaks' do
56
- output = slide_markdown.postprocess(basic_input)
57
- output.should include '<h1>First Slide</h1>'
58
- output.should include "</section>\n<section>"
59
- output.should include '<h1>Second Slide</h1>'
60
- end
61
-
62
- it 'trims off an initial <hr>' do
63
- output = slide_markdown.postprocess(leading_hr_input)
64
- output.should_not start_with "<section>\n</section>"
65
- end
66
-
67
- it 'trims off a trailing <hr>' do
68
- output = slide_markdown.postprocess(trailing_hr_input)
69
- output.should_not =~ /<section>\s*<\/section>/m
70
- end
71
-
72
75
  end
73
76
  end
74
77
  end