reveal-ck 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59fa7e933639f0da930a31f71e84254bb9d3bee6
4
- data.tar.gz: 29efbba155e601845b9c0b92ac2d9fbe5da2a8c6
3
+ metadata.gz: df93270d9e2bdca17cee3ef0509379fe78153fcb
4
+ data.tar.gz: c624080d7150241aabf1b8361e8fc54ed7eab878
5
5
  SHA512:
6
- metadata.gz: 0afaad9b2c6330e0002d53062fc9d391ec982723af5166d822ce786d70ff13af2ded8d56c17b50504aa51c58ded38cbfdfe4e16b2ab7d56b65b823f07dbc09cb
7
- data.tar.gz: c954437737b835917e0d6fad45b70e247867ba16cf889f7a2849c18e4024b2aa9ce5e7cfa15f5febc0405a9da6beedecb298dd9441c212a3e698fcb1f5859e8c
6
+ metadata.gz: c8940445840714a2086d192b98d69f237ec6ac98abbf6f4ad0b00b39c5e332b0f8d032cffbf1124266409381cccf78758790ad82e3f9766cd397583f64f24caf
7
+ data.tar.gz: b44c7be1a5174701e08f793aea6a0710196910642097a17a1499186c8d0590a7d3aa23ed4e441fc130e7da8803b789f827dcc1eed5ffd246e00a3d5ebf59e410
@@ -0,0 +1,17 @@
1
+ module HTML
2
+ class Pipeline
3
+ # This class is very similar EmojiFilter. It removes the inline
4
+ # width/height attributes so that reveal-ck supplied CSS takes effect.
5
+ class RevealCKEmojiFilter < EmojiFilter
6
+ def emoji_image_filter(text)
7
+ return text unless text.include?(':')
8
+
9
+ text.gsub(emoji_pattern) do
10
+ name = Regexp.last_match[1]
11
+ result = "<img class='emoji' title=':#{name}:' alt=':#{name}:' "
12
+ result + "src='#{emoji_url(name)}' align='absmiddle' />"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,4 +1,5 @@
1
1
  require 'html/pipeline'
2
+ require 'html/pipeline/reveal_ck_emoji_filter'
2
3
 
3
4
  module RevealCK
4
5
  module Builders
@@ -35,6 +36,7 @@ module RevealCK
35
36
  end
36
37
 
37
38
  def apply_filters_to(html)
39
+ load_dependencies(config.requires)
38
40
  filters = get_classes_from_array(config.filters)
39
41
  pipeline = HTML::Pipeline.new(filters)
40
42
  filtered_html_string = FilteredHtmlString.new(html: html,
@@ -43,6 +45,10 @@ module RevealCK
43
45
  filtered_html_string.render
44
46
  end
45
47
 
48
+ def load_dependencies(array_of_includes)
49
+ array_of_includes.each { |name| require name }
50
+ end
51
+
46
52
  def get_classes_from_array(array_of_names)
47
53
  array_of_names.map do |name|
48
54
  name.split('::').reduce(Object) { |a, e| a.const_get(e) }
@@ -51,21 +57,3 @@ module RevealCK
51
57
  end
52
58
  end
53
59
  end
54
-
55
- module HTML
56
- class Pipeline
57
- # This class is very similar EmojiFilter. It removes the inline
58
- # width/height attributes so that reveal-ck supplied CSS takes effect.
59
- class RevealCKEmojiFilter < EmojiFilter
60
- def emoji_image_filter(text)
61
- return text unless text.include?(':')
62
-
63
- text.gsub(emoji_pattern) 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
69
- end
70
- end
71
- end
@@ -37,7 +37,7 @@ module RevealCK
37
37
 
38
38
  def lib
39
39
  FileList["#{dir}/lib/**/*.css",
40
- "#{dir}/lib/font/*",
40
+ "#{dir}/lib/font/**/*",
41
41
  "#{dir}/lib/**/*.js"]
42
42
  end
43
43
 
@@ -50,7 +50,8 @@ module RevealCK
50
50
  'HTML::Pipeline::MentionFilter',
51
51
  'HTML::Pipeline::AutolinkFilter'],
52
52
  'asset_root' => 'https://assets-cdn.github.com/images/icons/',
53
- 'base_url' => 'https://github.com'
53
+ 'base_url' => 'https://github.com',
54
+ 'requires' => []
54
55
  }
55
56
  end
56
57
  end
@@ -1,4 +1,4 @@
1
1
  # RevealCK::VERSION is the current version of reveal-ck
2
2
  module RevealCK
3
- VERSION = '3.1.0'
3
+ VERSION = '3.2.0'
4
4
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ module HTML
4
+ class Pipeline
5
+ describe RevealCKEmojiFilter do
6
+ let :emoji_filter do
7
+ doc = nil
8
+ context = {
9
+ asset_root: 'asset_root'
10
+ }
11
+ RevealCKEmojiFilter.new doc, context
12
+ end
13
+
14
+ it 'works with defined emoji' do
15
+ expected = "I <img class='emoji' title=':heart:' "
16
+ expected += "alt=':heart:' src='asset_root/emoji/unicode/2764.png' "
17
+ expected += "align='absmiddle' /> emoji"
18
+ result = emoji_filter.emoji_image_filter('I :heart: emoji')
19
+ expect(result).to eq(expected)
20
+ end
21
+
22
+ it 'leaves undefined emoji alone' do
23
+ result = emoji_filter.emoji_image_filter('I :dont_know: emoji')
24
+ expect(result).to eq('I :dont_know: emoji')
25
+ end
26
+ end
27
+ end
28
+ end
@@ -54,6 +54,31 @@ module RevealCK
54
54
  end
55
55
  end
56
56
  end
57
+
58
+ it 'requires the entries in config.filters' do
59
+ Dir.mktmpdir do |dir|
60
+ Dir.chdir(dir) do
61
+ slides_file_initial = 'slides-initial.md'
62
+ File.open(slides_file_initial, 'w') do |file|
63
+ file.puts('# Slides')
64
+ end
65
+
66
+ config = Config.new
67
+ config.requires = %w(json time)
68
+ application = Rake::Application.new
69
+ slides_html =
70
+ CreateSlidesHtml.new(slides_file: slides_file_initial,
71
+ output_dir: dir,
72
+ config: config,
73
+ application: application)
74
+
75
+ slides_html.prepare
76
+ expect(slides_html).to receive(:require).with('json')
77
+ expect(slides_html).to receive(:require).with('time')
78
+ application['create_slides_html'].invoke
79
+ end
80
+ end
81
+ end
57
82
  end
58
83
  end
59
84
  end
@@ -1,10 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module RevealCK
4
- VERSION = '1.0'
5
-
6
4
  module Builders
7
5
  describe IndexHtml do
6
+ let(:version) { RevealCK::VERSION }
8
7
  let :index_html_erb do
9
8
  RevealCK.template_path('index.html',
10
9
  'index.html.erb')
@@ -46,7 +45,7 @@ module RevealCK
46
45
 
47
46
  it 'prints the program name and version in the generator tag' do
48
47
  expect(rendered_content)
49
- .to include('<meta name="generator" content="reveal-ck 1.0">')
48
+ .to include(%(<meta name="generator" content="reveal-ck #{version}">))
50
49
  end
51
50
 
52
51
  it 'supports replacing the configured title' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reveal-ck
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Northridge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-09 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docile
@@ -472,6 +472,7 @@ files:
472
472
  - files/reveal.js/test/test-pdf.js
473
473
  - files/reveal.js/test/test.html
474
474
  - files/reveal.js/test/test.js
475
+ - lib/html/pipeline/reveal_ck_emoji_filter.rb
475
476
  - lib/reveal-ck.rb
476
477
  - lib/reveal-ck/builders.rb
477
478
  - lib/reveal-ck/builders/copy_files_task.rb
@@ -539,6 +540,7 @@ files:
539
540
  - spec/data/templates/processor/basic.slim
540
541
  - spec/examples/programmatic_slides_spec.rb
541
542
  - spec/examples/slide_output_spec.rb
543
+ - spec/lib/html/pipeline/reveal_ck_emoji_filter_spec.rb
542
544
  - spec/lib/reveal-ck/builders/copy_files_task_spec.rb
543
545
  - spec/lib/reveal-ck/builders/create_index_html_spec.rb
544
546
  - spec/lib/reveal-ck/builders/create_slides_html_spec.rb
@@ -618,6 +620,7 @@ test_files:
618
620
  - spec/data/templates/processor/basic.slim
619
621
  - spec/examples/programmatic_slides_spec.rb
620
622
  - spec/examples/slide_output_spec.rb
623
+ - spec/lib/html/pipeline/reveal_ck_emoji_filter_spec.rb
621
624
  - spec/lib/reveal-ck/builders/copy_files_task_spec.rb
622
625
  - spec/lib/reveal-ck/builders/create_index_html_spec.rb
623
626
  - spec/lib/reveal-ck/builders/create_slides_html_spec.rb