nanoc 4.3.7 → 4.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +11 -0
  3. data/Gemfile +6 -6
  4. data/Gemfile.lock +32 -18
  5. data/NEWS.md +14 -0
  6. data/Rakefile +30 -1
  7. data/lib/nanoc.rb +3 -0
  8. data/lib/nanoc/base/checksummer.rb +28 -0
  9. data/lib/nanoc/base/compilation/compiler.rb +34 -20
  10. data/lib/nanoc/base/compilation/filter.rb +1 -1
  11. data/lib/nanoc/base/context.rb +5 -0
  12. data/lib/nanoc/base/entities/item_rep.rb +2 -13
  13. data/lib/nanoc/base/services.rb +1 -0
  14. data/lib/nanoc/base/services/compiler_loader.rb +2 -2
  15. data/lib/nanoc/{extra → base/services}/pruner.rb +56 -48
  16. data/lib/nanoc/checking.rb +11 -0
  17. data/lib/nanoc/{extra/checking → checking}/check.rb +3 -3
  18. data/lib/nanoc/checking/checks.rb +20 -0
  19. data/lib/nanoc/{extra/checking → checking}/checks/css.rb +2 -2
  20. data/lib/nanoc/{extra/checking → checking}/checks/external_links.rb +2 -2
  21. data/lib/nanoc/{extra/checking → checking}/checks/html.rb +2 -2
  22. data/lib/nanoc/{extra/checking → checking}/checks/internal_links.rb +2 -2
  23. data/lib/nanoc/{extra/checking → checking}/checks/mixed_content.rb +2 -2
  24. data/lib/nanoc/{extra/checking → checking}/checks/stale.rb +4 -3
  25. data/lib/nanoc/{extra/checking → checking}/checks/w3c_validator.rb +2 -2
  26. data/lib/nanoc/{extra/checking → checking}/dsl.rb +2 -2
  27. data/lib/nanoc/{extra/checking → checking}/issue.rb +1 -1
  28. data/lib/nanoc/{extra/checking → checking}/runner.rb +4 -4
  29. data/lib/nanoc/cli/cleaning_stream.rb +1 -1
  30. data/lib/nanoc/cli/commands/check.rb +1 -1
  31. data/lib/nanoc/cli/commands/compile.rb +62 -56
  32. data/lib/nanoc/cli/commands/deploy.rb +4 -4
  33. data/lib/nanoc/cli/commands/prune.rb +2 -2
  34. data/lib/nanoc/cli/commands/show-plugins.rb +4 -4
  35. data/lib/nanoc/data_sources/filesystem.rb +3 -1
  36. data/lib/nanoc/{extra/filesystem_tools.rb → data_sources/filesystem/tools.rb} +20 -15
  37. data/lib/nanoc/deploying.rb +8 -0
  38. data/lib/nanoc/{extra → deploying}/deployer.rb +2 -2
  39. data/lib/nanoc/deploying/deployers.rb +10 -0
  40. data/lib/nanoc/{extra → deploying}/deployers/fog.rb +3 -3
  41. data/lib/nanoc/{extra → deploying}/deployers/rsync.rb +3 -3
  42. data/lib/nanoc/extra.rb +9 -5
  43. data/lib/nanoc/filters/colorize_syntax.rb +15 -4
  44. data/lib/nanoc/filters/rdoc.rb +0 -5
  45. data/lib/nanoc/helpers/capturing.rb +2 -1
  46. data/lib/nanoc/rule_dsl/recording_executor.rb +7 -1
  47. data/lib/nanoc/spec.rb +10 -34
  48. data/lib/nanoc/version.rb +1 -1
  49. data/nanoc.gemspec +2 -1
  50. data/test/base/test_context.rb +6 -0
  51. data/test/base/test_dependency_tracker.rb +0 -18
  52. data/test/base/test_item_rep.rb +2 -2
  53. data/test/{extra/checking → checking}/checks/test_css.rb +4 -4
  54. data/test/{extra/checking → checking}/checks/test_external_links.rb +8 -8
  55. data/test/{extra/checking → checking}/checks/test_html.rb +3 -3
  56. data/test/{extra/checking → checking}/checks/test_internal_links.rb +9 -9
  57. data/test/{extra/checking → checking}/checks/test_mixed_content.rb +9 -9
  58. data/test/{extra/checking → checking}/checks/test_stale.rb +3 -3
  59. data/test/{extra/checking → checking}/test_check.rb +4 -4
  60. data/test/{extra/checking → checking}/test_dsl.rb +5 -5
  61. data/test/{extra/checking → checking}/test_runner.rb +4 -4
  62. data/test/data_sources/test_filesystem.rb +0 -18
  63. data/test/{extra → data_sources}/test_filesystem_tools.rb +13 -13
  64. data/test/{extra/deployers → deploying}/test_fog.rb +8 -8
  65. data/test/{extra/deployers → deploying}/test_rsync.rb +7 -7
  66. data/test/filters/{test_colorize_syntax.rb → colorize_syntax/test_coderay.rb} +1 -177
  67. data/test/filters/colorize_syntax/test_common.rb +81 -0
  68. data/test/filters/colorize_syntax/test_pygmentize.rb +35 -0
  69. data/test/filters/colorize_syntax/test_pygments.rb +17 -0
  70. data/test/filters/colorize_syntax/test_simon.rb +20 -0
  71. data/test/filters/test_less.rb +0 -55
  72. metadata +55 -43
  73. data/ChangeLog +0 -3
  74. data/doc/yardoc_handlers/identifier.rb +0 -30
  75. data/doc/yardoc_templates/default/layout/html/footer.erb +0 -19
  76. data/lib/nanoc/extra/checking.rb +0 -11
  77. data/lib/nanoc/extra/checking/checks.rb +0 -20
  78. data/lib/nanoc/extra/deployers.rb +0 -10
  79. data/tasks/doc.rake +0 -16
  80. data/tasks/rubocop.rake +0 -6
  81. data/tasks/test.rake +0 -25
  82. data/test/base/temp_filename_factory_spec.rb +0 -66
@@ -1,7 +1,7 @@
1
- class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
1
+ class Nanoc::Deploying::Deployers::FogTest < Nanoc::TestCase
2
2
  def test_read_etags_with_local_provider
3
3
  if_have 'fog' do
4
- fog = Nanoc::Extra::Deployers::Fog.new(
4
+ fog = Nanoc::Deploying::Deployers::Fog.new(
5
5
  'output/', provider: 'local'
6
6
  )
7
7
 
@@ -16,7 +16,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
16
16
 
17
17
  def test_read_etags_with_aws_provider
18
18
  if_have 'fog' do
19
- fog = Nanoc::Extra::Deployers::Fog.new(
19
+ fog = Nanoc::Deploying::Deployers::Fog.new(
20
20
  'output/', provider: 'aws'
21
21
  )
22
22
 
@@ -36,7 +36,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
36
36
 
37
37
  def test_calc_local_etag_with_local_provider
38
38
  if_have 'fog' do
39
- fog = Nanoc::Extra::Deployers::Fog.new(
39
+ fog = Nanoc::Deploying::Deployers::Fog.new(
40
40
  'output/', provider: 'local'
41
41
  )
42
42
 
@@ -49,7 +49,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
49
49
 
50
50
  def test_calc_local_etag_with_aws_provider
51
51
  if_have 'fog' do
52
- fog = Nanoc::Extra::Deployers::Fog.new(
52
+ fog = Nanoc::Deploying::Deployers::Fog.new(
53
53
  'output/', provider: 'aws'
54
54
  )
55
55
 
@@ -65,7 +65,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
65
65
 
66
66
  def test_needs_upload_with_missing_remote_etag
67
67
  if_have 'fog' do
68
- fog = Nanoc::Extra::Deployers::Fog.new(
68
+ fog = Nanoc::Deploying::Deployers::Fog.new(
69
69
  'output/', provider: 'aws'
70
70
  )
71
71
 
@@ -81,7 +81,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
81
81
 
82
82
  def test_needs_upload_with_different_etags
83
83
  if_have 'fog' do
84
- fog = Nanoc::Extra::Deployers::Fog.new(
84
+ fog = Nanoc::Deploying::Deployers::Fog.new(
85
85
  'output/', provider: 'aws'
86
86
  )
87
87
 
@@ -97,7 +97,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
97
97
 
98
98
  def test_needs_upload_with_identical_etags
99
99
  if_have 'fog' do
100
- fog = Nanoc::Extra::Deployers::Fog.new(
100
+ fog = Nanoc::Deploying::Deployers::Fog.new(
101
101
  'output/', provider: 'aws'
102
102
  )
103
103
 
@@ -1,7 +1,7 @@
1
- class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
1
+ class Nanoc::Deploying::Deployers::RsyncTest < Nanoc::TestCase
2
2
  def test_run_without_dst
3
3
  # Create deployer
4
- rsync = Nanoc::Extra::Deployers::Rsync.new(
4
+ rsync = Nanoc::Deploying::Deployers::Rsync.new(
5
5
  'output/',
6
6
  {},
7
7
  )
@@ -22,7 +22,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
22
22
 
23
23
  def test_run_with_erroneous_dst
24
24
  # Create deployer
25
- rsync = Nanoc::Extra::Deployers::Rsync.new(
25
+ rsync = Nanoc::Deploying::Deployers::Rsync.new(
26
26
  'output/',
27
27
  { dst: 'asdf/' },
28
28
  )
@@ -43,7 +43,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
43
43
 
44
44
  def test_run_everything_okay
45
45
  # Create deployer
46
- rsync = Nanoc::Extra::Deployers::Rsync.new(
46
+ rsync = Nanoc::Deploying::Deployers::Rsync.new(
47
47
  'output',
48
48
  { dst: 'asdf' },
49
49
  )
@@ -57,7 +57,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
57
57
  rsync.run
58
58
 
59
59
  # Check args
60
- opts = Nanoc::Extra::Deployers::Rsync::DEFAULT_OPTIONS
60
+ opts = Nanoc::Deploying::Deployers::Rsync::DEFAULT_OPTIONS
61
61
  assert_equal(
62
62
  ['rsync', opts, 'output/', 'asdf'].flatten,
63
63
  rsync.instance_eval { @shell_cms_args },
@@ -66,7 +66,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
66
66
 
67
67
  def test_run_everything_okay_dry
68
68
  # Create deployer
69
- rsync = Nanoc::Extra::Deployers::Rsync.new(
69
+ rsync = Nanoc::Deploying::Deployers::Rsync.new(
70
70
  'output',
71
71
  { dst: 'asdf' },
72
72
  dry_run: true,
@@ -81,7 +81,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
81
81
  rsync.run
82
82
 
83
83
  # Check args
84
- opts = Nanoc::Extra::Deployers::Rsync::DEFAULT_OPTIONS
84
+ opts = Nanoc::Deploying::Deployers::Rsync::DEFAULT_OPTIONS
85
85
  assert_equal(
86
86
  ['echo', 'rsync', opts, 'output/', 'asdf'].flatten,
87
87
  rsync.instance_eval { @shell_cms_args },
@@ -1,4 +1,4 @@
1
- class Nanoc::Filters::ColorizeSyntaxTest < Nanoc::TestCase
1
+ class Nanoc::Filters::ColorizeSyntax::CoderayTest < Nanoc::TestCase
2
2
  CODERAY_PRE = '<div class="CodeRay"><div class="code">'.freeze
3
3
  CODERAY_POST = '</div></div>'.freeze
4
4
 
@@ -17,56 +17,6 @@ class Nanoc::Filters::ColorizeSyntaxTest < Nanoc::TestCase
17
17
  end
18
18
  end
19
19
 
20
- def test_dummy
21
- if_have 'nokogiri' do
22
- # Create filter
23
- filter = ::Nanoc::Filters::ColorizeSyntax.new
24
-
25
- # Get input and expected output
26
- input = '<pre title="moo"><code class="language-ruby"># comment</code></pre>'
27
- expected_output = input # because we are using a dummy
28
-
29
- # Run filter
30
- actual_output = filter.setup_and_run(input, default_colorizer: :dummy)
31
- assert_equal(expected_output, actual_output)
32
- end
33
- end
34
-
35
- def test_with_frozen_input
36
- if_have 'nokogiri' do
37
- input = '<pre title="moo"><code class="language-ruby"># comment</code></pre>'.freeze
38
- input.freeze
39
-
40
- filter = ::Nanoc::Filters::ColorizeSyntax.new
41
- filter.setup_and_run(input, default_colorizer: :dummy)
42
- end
43
- end
44
-
45
- def test_full_page
46
- if_have 'nokogiri' do
47
- # Create filter
48
- filter = ::Nanoc::Filters::ColorizeSyntax.new
49
-
50
- # Get input and expected output
51
- input = <<EOS
52
- <!DOCTYPE html>
53
- <html>
54
- <head>
55
- <title>Foo</title>
56
- </head>
57
- <body>
58
- <pre title="moo"><code class="language-ruby"># comment</code></pre>
59
- </body>
60
- </html>
61
- EOS
62
- expected_output_regex = %r{^<!DOCTYPE html>\s*<html>\s*<head>\s*<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\s*<title>Foo</title>\s*</head>\s*<body>\s*<pre title="moo"><code class="language-ruby"># comment</code></pre>\s*</body>\s*</html>}
63
-
64
- # Run filter
65
- actual_output = filter.setup_and_run(input, default_colorizer: :dummy, is_fullpage: true)
66
- assert_match expected_output_regex, actual_output
67
- end
68
- end
69
-
70
20
  def test_coderay_with_comment
71
21
  if_have 'coderay', 'nokogiri' do
72
22
  # Create filter
@@ -132,58 +82,6 @@ EOS
132
82
  end
133
83
  end
134
84
 
135
- def test_pygmentize
136
- if_have 'nokogiri' do
137
- skip_unless_have_command 'pygmentize'
138
-
139
- # Create filter
140
- filter = ::Nanoc::Filters::ColorizeSyntax.new
141
-
142
- # Get input and expected output
143
- input = '<pre title="moo"><code class="language-ruby"># comment</code></pre>'
144
- expected_output = '<pre title="moo"><code class="language-ruby"><span class="c1"># comment</span></code></pre>'
145
-
146
- # Run filter
147
- actual_output = filter.setup_and_run(input, colorizers: { ruby: :pygmentize })
148
- assert_equal(expected_output, actual_output)
149
- end
150
- end
151
-
152
- def test_pygmentsrb
153
- skip 'pygments.rb does not support Windows' if on_windows?
154
- if_have 'pygments', 'nokogiri' do
155
- # Create filter
156
- filter = ::Nanoc::Filters::ColorizeSyntax.new
157
-
158
- # Get input and expected output
159
- input = '<pre title="moo"><code class="language-ruby"># comment…</code></pre>'
160
- expected_output = '<pre title="moo"><code class="language-ruby"><span class="c1"># comment…</span></code></pre>'
161
-
162
- # Run filter
163
- actual_output = filter.setup_and_run(input, colorizers: { ruby: :pygmentsrb })
164
- assert_equal(expected_output, actual_output)
165
- end
166
- end
167
-
168
- def test_simon_highlight
169
- if_have 'nokogiri' do
170
- skip_unless_have_command 'highlight'
171
-
172
- # Create filter
173
- filter = ::Nanoc::Filters::ColorizeSyntax.new
174
-
175
- # Get input and expected output
176
- input = %(<pre title="moo"><code class="language-ruby">
177
- # comment
178
- </code></pre>)
179
- expected_output = '<pre title="moo"><code class="language-ruby"><span class="hl slc"># comment</span></code></pre>'
180
-
181
- # Run filter
182
- actual_output = filter.setup_and_run(input, default_colorizer: :simon_highlight)
183
- assert_equal(expected_output, actual_output)
184
- end
185
- end
186
-
187
85
  def test_colorize_syntax_with_unknown_syntax
188
86
  if_have 'coderay', 'nokogiri' do
189
87
  # Create filter
@@ -226,53 +124,6 @@ EOS
226
124
  end
227
125
  end
228
126
 
229
- def test_colorize_syntax_with_default_colorizer
230
- skip_unless_have_command 'pygmentize'
231
-
232
- if_have 'nokogiri' do
233
- # Create filter
234
- filter = ::Nanoc::Filters::ColorizeSyntax.new
235
-
236
- # Get input and expected output
237
- input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
238
- expected_output = '<pre><code class="language-ruby"><span class="nb">puts</span> <span class="s2">"foo"</span></code></pre>'
239
-
240
- # Run filter
241
- actual_output = filter.setup_and_run(input, default_colorizer: :pygmentize)
242
- assert_equal(expected_output, actual_output)
243
- end
244
- end
245
-
246
- def test_colorize_syntax_with_missing_executables
247
- if_have 'nokogiri' do
248
- begin
249
- original_path = ENV['PATH']
250
- ENV['PATH'] = './blooblooblah'
251
-
252
- # Create filter
253
- filter = ::Nanoc::Filters::ColorizeSyntax.new
254
-
255
- # Get input and expected output
256
- input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
257
-
258
- # Run filter
259
- [:albino, :pygmentize, :simon_highlight].each do |colorizer|
260
- begin
261
- input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
262
- filter.setup_and_run(
263
- input,
264
- colorizers: { ruby: colorizer },
265
- )
266
- flunk 'expected colorizer to raise if no executable is available'
267
- rescue
268
- end
269
- end
270
- ensure
271
- ENV['PATH'] = original_path
272
- end
273
- end
274
- end
275
-
276
127
  def test_colorize_syntax_with_non_language_shebang_line
277
128
  if_have 'coderay', 'nokogiri' do
278
129
  # Create filter
@@ -389,31 +240,4 @@ EOS
389
240
  assert_equal(expected_output, actual_output)
390
241
  end
391
242
  end
392
-
393
- def test_rouge
394
- if_have 'rouge', 'nokogiri' do
395
- # Create filter
396
- filter = ::Nanoc::Filters::ColorizeSyntax.new
397
-
398
- # Get input and expected output
399
- input = <<EOS
400
- before
401
- <pre><code class="language-ruby">
402
- def foo
403
- end
404
- </code></pre>
405
- after
406
- EOS
407
- expected_output = <<EOS
408
- before
409
- <pre><code class=\"language-ruby\"> <span class=\"k\">def</span> <span class=\"nf\">foo</span>
410
- <span class=\"k\">end</span></code></pre>
411
- after
412
- EOS
413
-
414
- # Run filter
415
- actual_output = filter.setup_and_run(input, default_colorizer: :rouge)
416
- assert_equal(expected_output, actual_output)
417
- end
418
- end
419
243
  end
@@ -0,0 +1,81 @@
1
+ class Nanoc::Filters::ColorizeSyntax::CommonTest < Nanoc::TestCase
2
+ def test_dummy
3
+ if_have 'nokogiri' do
4
+ # Create filter
5
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
6
+
7
+ # Get input and expected output
8
+ input = '<pre title="moo"><code class="language-ruby"># comment</code></pre>'
9
+ expected_output = input # because we are using a dummy
10
+
11
+ # Run filter
12
+ actual_output = filter.setup_and_run(input, default_colorizer: :dummy)
13
+ assert_equal(expected_output, actual_output)
14
+ end
15
+ end
16
+
17
+ def test_with_frozen_input
18
+ if_have 'nokogiri' do
19
+ input = '<pre title="moo"><code class="language-ruby"># comment</code></pre>'.freeze
20
+ input.freeze
21
+
22
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
23
+ filter.setup_and_run(input, default_colorizer: :dummy)
24
+ end
25
+ end
26
+
27
+ def test_full_page
28
+ if_have 'nokogiri' do
29
+ # Create filter
30
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
31
+
32
+ # Get input and expected output
33
+ input = <<EOS
34
+ <!DOCTYPE html>
35
+ <html>
36
+ <head>
37
+ <title>Foo</title>
38
+ </head>
39
+ <body>
40
+ <pre title="moo"><code class="language-ruby"># comment</code></pre>
41
+ </body>
42
+ </html>
43
+ EOS
44
+ expected_output_regex = %r{^<!DOCTYPE html>\s*<html>\s*<head>\s*<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\s*<title>Foo</title>\s*</head>\s*<body>\s*<pre title="moo"><code class="language-ruby"># comment</code></pre>\s*</body>\s*</html>}
45
+
46
+ # Run filter
47
+ actual_output = filter.setup_and_run(input, default_colorizer: :dummy, is_fullpage: true)
48
+ assert_match expected_output_regex, actual_output
49
+ end
50
+ end
51
+
52
+ def test_colorize_syntax_with_missing_executables
53
+ if_have 'nokogiri' do
54
+ begin
55
+ original_path = ENV['PATH']
56
+ ENV['PATH'] = './blooblooblah'
57
+
58
+ # Create filter
59
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
60
+
61
+ # Get input and expected output
62
+ input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
63
+
64
+ # Run filter
65
+ [:albino, :pygmentize, :simon_highlight].each do |colorizer|
66
+ begin
67
+ input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
68
+ filter.setup_and_run(
69
+ input,
70
+ colorizers: { ruby: colorizer },
71
+ )
72
+ flunk 'expected colorizer to raise if no executable is available'
73
+ rescue
74
+ end
75
+ end
76
+ ensure
77
+ ENV['PATH'] = original_path
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,35 @@
1
+ class Nanoc::Filters::ColorizeSyntax::PygmentizeTest < Nanoc::TestCase
2
+ def test_pygmentize
3
+ if_have 'nokogiri' do
4
+ skip_unless_have_command 'pygmentize'
5
+
6
+ # Create filter
7
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
8
+
9
+ # Get input and expected output
10
+ input = '<pre title="moo"><code class="language-ruby"># comment</code></pre>'
11
+ expected_output = '<pre title="moo"><code class="language-ruby"><span class="c1"># comment</span></code></pre>'
12
+
13
+ # Run filter
14
+ actual_output = filter.setup_and_run(input, colorizers: { ruby: :pygmentize })
15
+ assert_equal(expected_output, actual_output)
16
+ end
17
+ end
18
+
19
+ def test_colorize_syntax_with_default_colorizer
20
+ skip_unless_have_command 'pygmentize'
21
+
22
+ if_have 'nokogiri' do
23
+ # Create filter
24
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
25
+
26
+ # Get input and expected output
27
+ input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
28
+ expected_output = '<pre><code class="language-ruby"><span class="nb">puts</span> <span class="s2">"foo"</span></code></pre>'
29
+
30
+ # Run filter
31
+ actual_output = filter.setup_and_run(input, default_colorizer: :pygmentize)
32
+ assert_equal(expected_output, actual_output)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ class Nanoc::Filters::ColorizeSyntax::PygmentsTest < Nanoc::TestCase
2
+ def test_pygmentsrb
3
+ skip 'pygments.rb does not support Windows' if on_windows?
4
+ if_have 'pygments', 'nokogiri' do
5
+ # Create filter
6
+ filter = ::Nanoc::Filters::ColorizeSyntax.new
7
+
8
+ # Get input and expected output
9
+ input = '<pre title="moo"><code class="language-ruby"># comment…</code></pre>'
10
+ expected_output = '<pre title="moo"><code class="language-ruby"><span class="c1"># comment…</span></code></pre>'
11
+
12
+ # Run filter
13
+ actual_output = filter.setup_and_run(input, colorizers: { ruby: :pygmentsrb })
14
+ assert_equal(expected_output, actual_output)
15
+ end
16
+ end
17
+ end