reveal-ck 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/bin/reveal-ck +0 -2
  4. data/lib/reveal-ck/markdown.rb +4 -3
  5. data/lib/reveal-ck/markdown/post_processor.rb +15 -0
  6. data/lib/reveal-ck/markdown/pre_processor.rb +15 -0
  7. data/lib/reveal-ck/version.rb +1 -1
  8. data/rakelib/relish.rake +0 -1
  9. data/spec/data/presentation_dsl/dsl.rb +0 -2
  10. data/spec/examples/programmatic_slides_spec.rb +0 -2
  11. data/spec/examples/slide_output_spec.rb +0 -2
  12. data/spec/lib/reveal-ck/builders/copy_files_task_spec.rb +0 -1
  13. data/spec/lib/reveal-ck/builders/create_index_html_spec.rb +0 -1
  14. data/spec/lib/reveal-ck/builders/create_slides_html_spec.rb +0 -2
  15. data/spec/lib/reveal-ck/builders/creation_task_spec.rb +0 -3
  16. data/spec/lib/reveal-ck/builders/rake_aware_spec.rb +0 -2
  17. data/spec/lib/reveal-ck/builders/slides_builder_spec.rb +0 -1
  18. data/spec/lib/reveal-ck/commands/listen_to_rebuild_slides_spec.rb +0 -1
  19. data/spec/lib/reveal-ck/commands/listen_to_reload_browser_spec.rb +0 -1
  20. data/spec/lib/reveal-ck/commands/print_banner_spec.rb +0 -1
  21. data/spec/lib/reveal-ck/commands/serve_spec.rb +1 -1
  22. data/spec/lib/reveal-ck/commands/serve_ui_spec.rb +0 -1
  23. data/spec/lib/reveal-ck/config_spec.rb +0 -2
  24. data/spec/lib/reveal-ck/markdown/post_processor_spec.rb +14 -5
  25. data/spec/lib/reveal-ck/markdown/pre_processor_spec.rb +13 -1
  26. data/spec/lib/reveal-ck/markdown/slide_markdown_spec.rb +0 -1
  27. data/spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb +14 -1
  28. data/spec/lib/reveal-ck/presentation_dsl_spec.rb +0 -2
  29. data/spec/lib/reveal-ck/presentation_spec.rb +0 -2
  30. data/spec/lib/reveal-ck/render/scope_spec.rb +0 -1
  31. data/spec/lib/reveal-ck/slide_spec.rb +0 -2
  32. data/spec/lib/reveal-ck/templates/finder_spec.rb +0 -4
  33. data/spec/lib/reveal-ck/templates/processor_spec.rb +0 -2
  34. data/spec/lib/reveal-ck/tilt/config_spec.rb +0 -2
  35. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4252fefb83fa8eec9c1b3a0d6d74334c2a0d0bf
4
- data.tar.gz: e29b9fdcc2b7fadbac285db39050326e15fae351
3
+ metadata.gz: 7827ff95cbcd95ab71edcb05af538b444034ce57
4
+ data.tar.gz: 5e4bbe103ed9e3df46ac980ab2c034ccf881a9d1
5
5
  SHA512:
6
- metadata.gz: d03ad188c7ca126d5825ca66fc882451ada4817b6a20ce914db0932884a35733e6d6414f010bb5a500087e50e5b20b5254bae2cc0ccc16822d6fc915a58418ff
7
- data.tar.gz: bf9d20304ea225b4ceb51c7833a43c2b2d16ffd71f0ad17549e6c8c9537cd942c5a11054a882eba4c73026f6356643861bbfce79302f217bd0f6b7947af0cfde
6
+ metadata.gz: 13546e79c4ceca5245cae207289759924f1ac11e37977764a93317364a73cafbd160e190a0f46ace2d4629d0077d49a88151f261e3728539062b7b698f0bc06e
7
+ data.tar.gz: 0476d2073d10a09620f74a34a70e31895b06066e64625577dca91475e0ea2bc6ca3f23048f28bb8ba78e457287533ed8ee06855627b72de1cc7284d14f940579
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Make Slides with a Quickness
1
+ # Create Slides with Markdown
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/reveal-ck.svg)](http://badge.fury.io/rb/reveal-ck)
4
4
 
@@ -112,6 +112,11 @@ Here's a quick example of what it's like to work with reveal-ck:
112
112
  If find these ideas intriguing, you can learn more at
113
113
  http://jedcn.github.io/reveal-ck/.
114
114
 
115
+ ## Contributing
116
+
117
+ If you'd like to log a bug, propose an issue, or get going with local
118
+ development, please see [doc/CONTRIBUTING.md](doc/CONTRIBUTING.md).
119
+
115
120
  ## Questions?
116
121
 
117
122
  If you have questions, find me on github ([@jedcn][github-jedcn]) or
data/bin/reveal-ck CHANGED
@@ -11,7 +11,6 @@ class RevealCKExecutable
11
11
 
12
12
  desc 'Generate reveal.js slides'
13
13
  command :generate do |c|
14
-
15
14
  slide_files = FileList['slides.*']
16
15
  default_file = slide_files.empty? ? nil : slide_files.first
17
16
 
@@ -49,7 +48,6 @@ class RevealCKExecutable
49
48
 
50
49
  desc 'Start webserver so slides are available via http'
51
50
  command :serve, :server do |c|
52
-
53
51
  slide_files = FileList['slides.*']
54
52
  default_file = slide_files.empty? ? nil : slide_files.first
55
53
 
@@ -2,9 +2,10 @@ module RevealCK
2
2
  # This module defines how reveal-ck works with redcarpet to produce
3
3
  # slides from markdown.
4
4
  module Markdown
5
- REVEALCK_SYMBOL_FOR_DIVIDER = '<div>DIVIDER</div>'
6
- REVEALCK_SYMBOL_FOR_VERTICAL_START = '<div>VERTICAL_START</div>'
7
- REVEALCK_SYMBOL_FOR_VERTICAL_END = '<div>VERTICAL_END</div>'
5
+ REVEALCK_SYMBOL_FOR_DIVIDER = '<div>DIVIDER</div>'
6
+ REVEALCK_SYMBOL_FOR_VERTICAL_START = '<div>VERTICAL_START</div>'
7
+ REVEALCK_SYMBOL_FOR_VERTICAL_END = '<div>VERTICAL_END</div>'
8
+ REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE = 'EU'
8
9
  end
9
10
  end
10
11
 
@@ -11,6 +11,7 @@ module RevealCK
11
11
 
12
12
  def process
13
13
  strip_whitespace
14
+ unprotect_emojis
14
15
  handle_start
15
16
  handle_end
16
17
  transform_symbols_to_sections
@@ -22,6 +23,12 @@ module RevealCK
22
23
  @doc = doc.strip
23
24
  end
24
25
 
26
+ def unprotect_emojis
27
+ @doc = doc.gsub(protected_emoji_regex) do |protected_emoji|
28
+ protected_emoji.gsub(emoji_underscore_symbol, '_')
29
+ end
30
+ end
31
+
25
32
  def handle_start
26
33
  replace_if_start_with(vertical_start_symbol, vertical_start_doc)
27
34
  replace_if_start_with(divider_symbol, divider_start)
@@ -84,6 +91,10 @@ module RevealCK
84
91
  "#{divider_end}\n#{divider_start}"
85
92
  end
86
93
 
94
+ def emoji_underscore_symbol
95
+ RevealCK::Markdown::REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE
96
+ end
97
+
87
98
  def divider_symbol
88
99
  RevealCK::Markdown::REVEALCK_SYMBOL_FOR_DIVIDER
89
100
  end
@@ -96,6 +107,10 @@ module RevealCK
96
107
  RevealCK::Markdown::REVEALCK_SYMBOL_FOR_VERTICAL_END
97
108
  end
98
109
 
110
+ def protected_emoji_regex
111
+ /:[a-z\d_\-\+EU]*:/
112
+ end
113
+
99
114
  def back_to_back_vertical_symbols_regex
100
115
  vertical_end = Regexp.escape(vertical_end_symbol)
101
116
  vertical_start = Regexp.escape(vertical_start_symbol)
@@ -11,6 +11,7 @@ module RevealCK
11
11
 
12
12
  def process
13
13
  strip_whitespace
14
+ protect_emojis
14
15
  add_first_slide_divider_if_needed
15
16
  add_last_slide_vertical_if_needed
16
17
  add_last_slide_divider_if_needed
@@ -25,6 +26,12 @@ module RevealCK
25
26
  @doc = doc.strip
26
27
  end
27
28
 
29
+ def protect_emojis
30
+ @doc = doc.gsub(emoji_regex) do |emoji|
31
+ emoji.gsub(/_/, emoji_underscore_symbol)
32
+ end
33
+ end
34
+
28
35
  def add_first_slide_divider_if_needed
29
36
  return if doc.start_with?(slide_divider)
30
37
  return if doc.start_with?(slide_vertical)
@@ -60,6 +67,10 @@ module RevealCK
60
67
  append(slide_vertical)
61
68
  end
62
69
 
70
+ def emoji_regex
71
+ /:[a-z\d_\-\+]*:/
72
+ end
73
+
63
74
  def slide_divider
64
75
  '---'
65
76
  end
@@ -88,6 +99,10 @@ module RevealCK
88
99
  "\n#{s}\n"
89
100
  end
90
101
 
102
+ def emoji_underscore_symbol
103
+ RevealCK::Markdown::REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE
104
+ end
105
+
91
106
  def divider_symbol
92
107
  RevealCK::Markdown::REVEALCK_SYMBOL_FOR_DIVIDER
93
108
  end
@@ -1,4 +1,4 @@
1
1
  # RevealCK::VERSION is the current version of reveal-ck
2
2
  module RevealCK
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.1'
4
4
  end
data/rakelib/relish.rake CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  namespace :relish do
3
-
4
3
  def run(cmd)
5
4
  require 'open3'
6
5
  puts "Running '#{cmd}'"
@@ -1,5 +1,4 @@
1
1
  presentation do
2
-
3
2
  title 'Presentation Title'
4
3
  author 'Presentation Author'
5
4
  theme 'night'
@@ -14,5 +13,4 @@ presentation do
14
13
 
15
14
  slide 'text',
16
15
  content: 'Thanks!'
17
-
18
16
  end
@@ -1,12 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'examples/programmatic_slides.rb' do
4
-
5
4
  it 'prints output from a presentation with several slides' do
6
5
  expect($stdout).to receive :puts
7
6
  expect do
8
7
  load 'examples/programmatic_slides.rb'
9
8
  end.to_not raise_error
10
9
  end
11
-
12
10
  end
@@ -1,12 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'examples/slide_output.rb' do
4
-
5
4
  it 'prints output from a single slide' do
6
5
  expect($stdout).to receive :puts
7
6
  expect do
8
7
  load 'examples/slide_output.rb'
9
8
  end.to_not raise_error
10
9
  end
11
-
12
10
  end
@@ -42,7 +42,6 @@ module RevealCK
42
42
  end
43
43
 
44
44
  it 'creates the directory from the file_listing' do
45
-
46
45
  task = CopyFilesTask.new(application: Rake::Application.new,
47
46
  file_listing: file_listing,
48
47
  output_dir: destination_directory)
@@ -8,7 +8,6 @@ module RevealCK
8
8
  it 'creates a reveal.js index.html' do
9
9
  Dir.mktmpdir do |dir|
10
10
  Dir.chdir(dir) do
11
-
12
11
  slides_html = 'slides.html'
13
12
  File.open(slides_html, 'w') do |file|
14
13
  file.puts('<section>')
@@ -8,7 +8,6 @@ module RevealCK
8
8
  it 'creates a transformed slides file' do
9
9
  Dir.mktmpdir do |dir|
10
10
  Dir.chdir(dir) do
11
-
12
11
  slides_file_initial = 'slides-initial.md'
13
12
  File.open(slides_file_initial, 'w') do |file|
14
13
  file.puts('# Slides')
@@ -34,7 +33,6 @@ module RevealCK
34
33
  it 'can transform emoji' do
35
34
  Dir.mktmpdir do |dir|
36
35
  Dir.chdir(dir) do
37
-
38
36
  slides_file_initial = 'slides-initial.md'
39
37
  File.open(slides_file_initial, 'w') do |file|
40
38
  file.puts('# I :heart: Slides')
@@ -17,7 +17,6 @@ module RevealCK
17
17
  end
18
18
 
19
19
  describe CreationTask do
20
-
21
20
  describe '#name' do
22
21
  it 'underscores the name of the Class' do
23
22
  application = double
@@ -37,9 +36,7 @@ module RevealCK
37
36
  end
38
37
 
39
38
  describe 'a subclass with a complete implementation' do
40
-
41
39
  describe '#prepare' do
42
-
43
40
  it 'invokes setup' do
44
41
  application = double
45
42
  expect(application).to receive(:define_task)
@@ -12,9 +12,7 @@ module RevealCK
12
12
  end
13
13
 
14
14
  describe RakeAware do
15
-
16
15
  describe 'when included into a class with a rake application' do
17
-
18
16
  let :example do
19
17
  RakeAwareTestingClass.new
20
18
  end
@@ -7,7 +7,6 @@ module RevealCK
7
7
  it 'creates a reveal.js presentation' do
8
8
  Dir.mktmpdir do |dir|
9
9
  Dir.chdir(dir) do
10
-
11
10
  slides_file = 'slides.md'
12
11
  File.open(slides_file, 'w') do |file|
13
12
  file.puts('# Slides')
@@ -5,7 +5,6 @@ module RevealCK
5
5
  module Commands
6
6
  describe ListenToRebuildSlides do
7
7
  describe '#run' do
8
-
9
8
  let :current_directory do
10
9
  '.'
11
10
  end
@@ -6,7 +6,6 @@ module RevealCK
6
6
  describe ListenToReloadBrowser do
7
7
  describe '#run' do
8
8
  it 'works with Guard to setup livereload' do
9
-
10
9
  serve_ui = double
11
10
 
12
11
  expect(serve_ui)
@@ -5,7 +5,6 @@ module RevealCK
5
5
  describe PrintBanner do
6
6
  describe '#run' do
7
7
  it 'sends #messages and #separators to the ui' do
8
-
9
8
  serve_ui = double
10
9
 
11
10
  expect(serve_ui)
@@ -116,7 +116,7 @@ module RevealCK
116
116
  # Creating the file will trigger the call back. But need
117
117
  # to wait else the expecation of :rebuild_slides will
118
118
  # fail-- it's not instantaneous
119
- sleep 0.25
119
+ sleep 0.5
120
120
  end
121
121
  end
122
122
  end
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  module RevealCK
4
4
  module Commands
5
5
  describe ServeUI do
6
-
7
6
  let :serve_ui do
8
7
  ServeUI.new
9
8
  end
@@ -2,13 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  module RevealCK
4
4
  describe Config do
5
-
6
5
  let :config do
7
6
  Config.new
8
7
  end
9
8
 
10
9
  describe 'core attributes' do
11
-
12
10
  it 'supplies a default theme' do
13
11
  expect(config.theme).to eq 'default'
14
12
  end
@@ -3,8 +3,21 @@ require 'spec_helper'
3
3
  module RevealCK
4
4
  module Markdown
5
5
  describe PostProcessor do
6
- context 'without vertical slides' do
6
+ it 'unprotects emojis' do
7
+ input = ':moneyEUwithEUwings:'
8
+ output = PostProcessor.new(input).process
9
+ expect(output).to include ':money_with_wings:'
10
+
11
+ input = ':blueEUheart:'
12
+ output = PostProcessor.new(input).process
13
+ expect(output).to include ':blue_heart:'
14
+
15
+ input = ':non-potableEUwater:'
16
+ output = PostProcessor.new(input).process
17
+ expect(output).to include ':non-potable_water:'
18
+ end
7
19
 
20
+ context 'without vertical slides' do
8
21
  let :three_slide_input do
9
22
  <<-eos
10
23
  <div>DIVIDER</div>
@@ -60,9 +73,7 @@ eos
60
73
  end
61
74
 
62
75
  context 'with vertical slides' do
63
-
64
76
  context 'single vertical slide' do
65
-
66
77
  let :single_vertical_input do
67
78
  <<-eos
68
79
  <div>VERTICAL_START</div>
@@ -120,7 +131,6 @@ eos
120
131
  end
121
132
 
122
133
  context 'back-to-back vertical slides' do
123
-
124
134
  let :double_vertical_input do
125
135
  <<-eos
126
136
  <div>VERTICAL_START</div>
@@ -201,7 +211,6 @@ eos
201
211
  end
202
212
 
203
213
  context 'horizontal and vertical combinations' do
204
-
205
214
  let :verticals_surrounded_by_horizontals_input do
206
215
  <<-eos
207
216
  <div>DIVIDER</div>
@@ -3,6 +3,19 @@ require 'spec_helper'
3
3
  module RevealCK
4
4
  module Markdown
5
5
  describe PreProcessor do
6
+ it 'protects _s within emoji by turning them into a temporary token' do
7
+ input = ':money_with_wings:'
8
+ output = PreProcessor.new(input).process
9
+ expect(output).to include ':moneyEUwithEUwings:'
10
+
11
+ input = ':blue_heart:'
12
+ output = PreProcessor.new(input).process
13
+ expect(output).to include ':blueEUheart:'
14
+
15
+ input = ':non-potable_water:'
16
+ output = PreProcessor.new(input).process
17
+ expect(output).to include ':non-potableEUwater:'
18
+ end
6
19
 
7
20
  let :standard_result do
8
21
  <<-eos
@@ -85,7 +98,6 @@ eos
85
98
  end
86
99
 
87
100
  context 'with vertical slides' do
88
-
89
101
  let :single_vertical_output do
90
102
  <<-eos
91
103
  <div>VERTICAL_START</div>
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  module RevealCK
4
4
  module Markdown
5
5
  describe SlideMarkdown do
6
-
7
6
  end
8
7
  end
9
8
  end
@@ -4,7 +4,6 @@ require 'tempfile'
4
4
  module RevealCK
5
5
  module Markdown
6
6
  describe SlideMarkdownTemplate do
7
-
8
7
  def render_markdown(markdown)
9
8
  tmp_file = Tempfile.new(['test', '.md'])
10
9
  File.open(tmp_file, 'w') do |test_md|
@@ -14,6 +13,20 @@ module RevealCK
14
13
  template.render
15
14
  end
16
15
 
16
+ it 'does not turn _s within a single emoji into <em>s' do
17
+ output = render_markdown <<-eos
18
+ :money_with_wings:
19
+ eos
20
+ expect(output).to include ':money_with_wings:'
21
+ end
22
+
23
+ it 'does not turn _s between two emojis into <em>s' do
24
+ output = render_markdown <<-eos
25
+ :blue_heart: :blue_heart:
26
+ eos
27
+ expect(output).to include ':blue_heart: :blue_heart:'
28
+ end
29
+
17
30
  it 'uses "---" to create "<section>"s' do
18
31
  output = render_markdown <<-eos
19
32
  # h1 Slide
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  module RevealCK
4
4
  describe PresentationDSL do
5
-
6
5
  let :config do
7
6
  Config.new
8
7
  end
@@ -23,7 +22,6 @@ module RevealCK
23
22
  end
24
23
 
25
24
  describe 'A Presentation loaded from a dsl' do
26
-
27
25
  let :html do
28
26
  presentation.html
29
27
  end
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  module RevealCK
4
4
  describe Presentation do
5
-
6
5
  let :config do
7
6
  Config.new
8
7
  end
@@ -79,6 +78,5 @@ module RevealCK
79
78
  expect(html).to start_with '<section>'
80
79
  end
81
80
  end
82
-
83
81
  end
84
82
  end
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  module RevealCK
4
4
  module Render
5
5
  describe Scope do
6
-
7
6
  describe '#contents_of' do
8
7
  let :quote_file do
9
8
  spec_data 'render', 'scope', 'quote'
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  module RevealCK
4
4
  describe Slide do
5
-
6
5
  let :intro_slide do
7
6
  Slide.new template: 'intro',
8
7
  title: 'Reveal.js',
@@ -18,6 +17,5 @@ module RevealCK
18
17
  expect(output).to include 'Reveal.js'
19
18
  end
20
19
  end
21
-
22
20
  end
23
21
  end
@@ -5,13 +5,11 @@ require 'fileutils'
5
5
  module RevealCK
6
6
  module Templates
7
7
  describe Finder do
8
-
9
8
  let :reveal_ck_dir do
10
9
  Dir.pwd
11
10
  end
12
11
 
13
12
  describe '#paths' do
14
-
15
13
  it 'defaults to Dir.pwd/templates and reveal-ck\'s slide templates' do
16
14
  Dir.mktmpdir do |dir|
17
15
  Dir.chdir(dir) do
@@ -33,11 +31,9 @@ module RevealCK
33
31
  expect(finder.paths.size).to eq 2
34
32
  end
35
33
  end
36
-
37
34
  end
38
35
 
39
36
  describe '#find' do
40
-
41
37
  let :project_templates do
42
38
  spec_data 'templates', 'finder', 'templates'
43
39
  end
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  module RevealCK
4
4
  module Templates
5
5
  describe Processor do
6
-
7
6
  let :config do
8
7
  Config.new
9
8
  end
@@ -29,7 +28,6 @@ module RevealCK
29
28
  processor = Processor.open file: haml_file, config: config
30
29
  expect(processor.output).to match pretty_printed_basic
31
30
  end
32
-
33
31
  end
34
32
  end
35
33
  end
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Tilt Configuration' do
4
-
5
4
  it 'uses SlideMarkdown to handle .md files' do
6
5
  expect(Tilt['md']).to eq(RevealCK::Markdown::SlideMarkdownTemplate)
7
6
  end
8
-
9
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reveal-ck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Northridge
@@ -560,7 +560,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
560
560
  version: '0'
561
561
  requirements: []
562
562
  rubyforge_project:
563
- rubygems_version: 2.2.1
563
+ rubygems_version: 2.2.0
564
564
  signing_key:
565
565
  specification_version: 4
566
566
  summary: A toolkit that takes a minimal description of slides and builds a reveal.js