nanoc 3.7.3 → 3.7.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
|
|
4
4
|
def setup
|
|
5
5
|
super
|
|
6
|
-
|
|
6
|
+
skip_unless_symlinks_supported
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def test_all_files_in_follows_symlinks_to_dirs
|
|
@@ -60,7 +60,7 @@ class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
|
|
|
60
60
|
|
|
61
61
|
File.symlink('../bar', 'foo/barlink')
|
|
62
62
|
|
|
63
|
-
expected_files = [
|
|
63
|
+
expected_files = ['foo/barlink/y.md', 'foo/x.md']
|
|
64
64
|
actual_files = Nanoc::Extra::FilesystemTools.all_files_in('foo').sort
|
|
65
65
|
assert_equal expected_files, actual_files
|
|
66
66
|
end
|
|
@@ -73,7 +73,7 @@ class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
|
|
|
73
73
|
File.symlink('../bar', 'dir/bar-link')
|
|
74
74
|
|
|
75
75
|
# Check
|
|
76
|
-
expected_files = [
|
|
76
|
+
expected_files = ['dir/bar-link', 'dir/foo']
|
|
77
77
|
actual_files = Nanoc::Extra::FilesystemTools.all_files_in('dir').sort
|
|
78
78
|
assert_equal expected_files, actual_files
|
|
79
79
|
end
|
|
@@ -5,16 +5,23 @@ class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
|
|
|
5
5
|
def test_all
|
|
6
6
|
# Create dummy data
|
|
7
7
|
File.open('file-a.html', 'w') do |io|
|
|
8
|
-
io << %
|
|
9
|
-
|
|
10
|
-
io << %
|
|
11
|
-
|
|
12
|
-
io << %
|
|
8
|
+
io << %(<a href="http://example.com/">A 1</a>
|
|
9
|
+
)
|
|
10
|
+
io << %(<a href="https://example.com/">A 2</a>
|
|
11
|
+
)
|
|
12
|
+
io << %(<a href="stuff/"A 3></a>
|
|
13
|
+
)
|
|
14
|
+
io << %(<a name="href-less-anchor">A 4</a>)
|
|
15
|
+
io << %(<a href="https://example.com/with-fragment#moo">A 5</a>
|
|
16
|
+
)
|
|
13
17
|
end
|
|
14
18
|
File.open('file-b.html', 'w') do |io|
|
|
15
|
-
io << %
|
|
16
|
-
|
|
17
|
-
io << %
|
|
19
|
+
io << %(<a href="mailto:bob@example.com">B 1</a>
|
|
20
|
+
)
|
|
21
|
+
io << %(<a href="../stuff">B 2</a>
|
|
22
|
+
)
|
|
23
|
+
io << %(<a href="/stuff">B 3</a>
|
|
24
|
+
)
|
|
18
25
|
end
|
|
19
26
|
|
|
20
27
|
# Create validator
|
|
@@ -37,14 +44,20 @@ class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
|
|
|
37
44
|
def test_external
|
|
38
45
|
# Create dummy data
|
|
39
46
|
File.open('file-a.html', 'w') do |io|
|
|
40
|
-
io << %
|
|
41
|
-
|
|
42
|
-
io << %
|
|
47
|
+
io << %(<a href="http://example.com/">A 1</a>
|
|
48
|
+
)
|
|
49
|
+
io << %(<a href="https://example.com/">A 2</a>
|
|
50
|
+
)
|
|
51
|
+
io << %(<a href="stuff/"A 3></a>
|
|
52
|
+
)
|
|
43
53
|
end
|
|
44
54
|
File.open('file-b.html', 'w') do |io|
|
|
45
|
-
io << %
|
|
46
|
-
|
|
47
|
-
io << %
|
|
55
|
+
io << %(<a href="mailto:bob@example.com">B 1</a>
|
|
56
|
+
)
|
|
57
|
+
io << %(<a href="../stuff">B 2</a>
|
|
58
|
+
)
|
|
59
|
+
io << %(<a href="/stuff">B 3</a>
|
|
60
|
+
)
|
|
48
61
|
end
|
|
49
62
|
|
|
50
63
|
# Create validator
|
|
@@ -64,14 +77,20 @@ class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
|
|
|
64
77
|
def test_internal
|
|
65
78
|
# Create dummy data
|
|
66
79
|
File.open('file-a.html', 'w') do |io|
|
|
67
|
-
io << %
|
|
68
|
-
|
|
69
|
-
io << %
|
|
80
|
+
io << %(<a href="http://example.com/">A 1</a>
|
|
81
|
+
)
|
|
82
|
+
io << %(<a href="https://example.com/">A 2</a>
|
|
83
|
+
)
|
|
84
|
+
io << %(<a href="stuff/"A 3></a>
|
|
85
|
+
)
|
|
70
86
|
end
|
|
71
87
|
File.open('file-b.html', 'w') do |io|
|
|
72
|
-
io << %
|
|
73
|
-
|
|
74
|
-
io << %
|
|
88
|
+
io << %(<a href="mailto:bob@example.com">B 1</a>
|
|
89
|
+
)
|
|
90
|
+
io << %(<a href="../stuff">B 2</a>
|
|
91
|
+
)
|
|
92
|
+
io << %(<a href="/stuff">B 3</a>
|
|
93
|
+
)
|
|
75
94
|
end
|
|
76
95
|
|
|
77
96
|
# Create validator
|
|
@@ -6,14 +6,14 @@ class Nanoc::Extra::Validators::W3CTest < Nanoc::TestCase
|
|
|
6
6
|
if_have 'w3c_validators' do
|
|
7
7
|
with_site do |site|
|
|
8
8
|
# Create some sample files
|
|
9
|
-
%w
|
|
10
|
-
%w
|
|
11
|
-
File.open("output/#{filename}.#{extension}", 'w') { |io| io.write(
|
|
9
|
+
%w(foo bar baz).each do |filename|
|
|
10
|
+
%w(xxx yyy).each do |extension|
|
|
11
|
+
File.open("output/#{filename}.#{extension}", 'w') { |io| io.write('hello') }
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Create validator
|
|
16
|
-
w3c = Nanoc::Extra::Validators::W3C.new('.', [
|
|
16
|
+
w3c = Nanoc::Extra::Validators::W3C.new('.', [:html])
|
|
17
17
|
|
|
18
18
|
# Run
|
|
19
19
|
w3c.run
|
|
@@ -25,7 +25,7 @@ class Nanoc::Extra::Validators::W3CTest < Nanoc::TestCase
|
|
|
25
25
|
if_have 'w3c_validators' do
|
|
26
26
|
with_site do |site|
|
|
27
27
|
# Create validator
|
|
28
|
-
w3c = Nanoc::Extra::Validators::W3C.new('.', [
|
|
28
|
+
w3c = Nanoc::Extra::Validators::W3C.new('.', [:foo])
|
|
29
29
|
|
|
30
30
|
# Test
|
|
31
31
|
exception = assert_raises Nanoc::Errors::GenericTrivial do
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
class Nanoc::Filters::AsciiDocTest < Nanoc::TestCase
|
|
4
4
|
|
|
5
5
|
def test_filter
|
|
6
|
-
skip_unless_have_command
|
|
6
|
+
skip_unless_have_command 'asciidoc'
|
|
7
7
|
|
|
8
8
|
# Create filter
|
|
9
9
|
filter = ::Nanoc::Filters::AsciiDoc.new
|
|
10
10
|
|
|
11
11
|
# Run filter
|
|
12
|
-
result = filter.setup_and_run(
|
|
12
|
+
result = filter.setup_and_run('== Blah blah')
|
|
13
13
|
assert_match %r{<h2 id="_blah_blah">Blah blah</h2>}, result
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -8,7 +8,7 @@ class Nanoc::Filters::BlueClothTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::BlueCloth.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
11
|
+
result = filter.setup_and_run('> Quote')
|
|
12
12
|
assert_match %r{<blockquote>\s*<p>Quote</p>\s*</blockquote>}, result
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -9,7 +9,7 @@ class Nanoc::Filters::CoffeeScriptTest < Nanoc::TestCase
|
|
|
9
9
|
|
|
10
10
|
# Run filter (no assigns)
|
|
11
11
|
result = filter.setup_and_run('alert 42')
|
|
12
|
-
assert_equal(
|
|
12
|
+
assert_equal('(function() { alert(42); }).call(this); ', result.gsub(/\s+/, ' '))
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -62,7 +62,7 @@ class Nanoc::Filters::ColorizeSyntaxTest < Nanoc::TestCase
|
|
|
62
62
|
</body>
|
|
63
63
|
</html>
|
|
64
64
|
EOS
|
|
65
|
-
expected_output_regex = %r
|
|
65
|
+
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>}
|
|
66
66
|
|
|
67
67
|
# Run filter
|
|
68
68
|
actual_output = filter.setup_and_run(input, :default_colorizer => :dummy, :is_fullpage => true)
|
|
@@ -76,7 +76,8 @@ EOS
|
|
|
76
76
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
77
77
|
|
|
78
78
|
# Get input and expected output
|
|
79
|
-
input = %
|
|
79
|
+
input = %(<pre title="moo"><code>#!ruby
|
|
80
|
+
# comment</code></pre>)
|
|
80
81
|
expected_output = CODERAY_PRE + '<pre title="moo"><code class="language-ruby"><span class="comment"># comment</span></code></pre>' + CODERAY_POST
|
|
81
82
|
|
|
82
83
|
# Run filter
|
|
@@ -91,7 +92,9 @@ EOS
|
|
|
91
92
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
92
93
|
|
|
93
94
|
# Get input and expected output
|
|
94
|
-
input = %
|
|
95
|
+
input = %(<pre title="moo"><code>def moo ; end
|
|
96
|
+
#!ruby
|
|
97
|
+
# comment</code></pre>)
|
|
95
98
|
expected_output = "<pre title=\"moo\"><code>def moo ; end\n#!ruby\n# comment</code></pre>"
|
|
96
99
|
|
|
97
100
|
# Run filter
|
|
@@ -106,8 +109,10 @@ EOS
|
|
|
106
109
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
107
110
|
|
|
108
111
|
# Get input and expected output
|
|
109
|
-
input = %
|
|
110
|
-
|
|
112
|
+
input = %(<pre title="moo"><code class="language-ruby">#!ruby
|
|
113
|
+
# comment</code></pre>)
|
|
114
|
+
expected_output = CODERAY_PRE + %(<pre title="moo"><code class="language-ruby"><span class="doctype">#!ruby</span>
|
|
115
|
+
<span class="comment"># comment</span></code></pre>) + CODERAY_POST
|
|
111
116
|
|
|
112
117
|
# Run filter
|
|
113
118
|
actual_output = filter.setup_and_run(input)
|
|
@@ -132,7 +137,7 @@ EOS
|
|
|
132
137
|
|
|
133
138
|
def test_pygmentize
|
|
134
139
|
if_have 'nokogiri' do
|
|
135
|
-
skip_unless_have_command
|
|
140
|
+
skip_unless_have_command 'pygmentize'
|
|
136
141
|
|
|
137
142
|
# Create filter
|
|
138
143
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
@@ -148,7 +153,7 @@ EOS
|
|
|
148
153
|
end
|
|
149
154
|
|
|
150
155
|
def test_pygmentsrb
|
|
151
|
-
skip
|
|
156
|
+
skip 'pygments.rb does not support Windows' if on_windows?
|
|
152
157
|
if_have 'pygments', 'nokogiri' do
|
|
153
158
|
# Create filter
|
|
154
159
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
@@ -165,13 +170,15 @@ EOS
|
|
|
165
170
|
|
|
166
171
|
def test_simon_highlight
|
|
167
172
|
if_have 'nokogiri' do
|
|
168
|
-
skip_unless_have_command
|
|
173
|
+
skip_unless_have_command 'highlight'
|
|
169
174
|
|
|
170
175
|
# Create filter
|
|
171
176
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
172
177
|
|
|
173
178
|
# Get input and expected output
|
|
174
|
-
input = %Q
|
|
179
|
+
input = %Q(<pre title="moo"><code class="language-ruby">
|
|
180
|
+
# comment
|
|
181
|
+
</code></pre>)
|
|
175
182
|
expected_output = '<pre title="moo"><code class="language-ruby"><span class="hl slc"># comment</span></code></pre>'
|
|
176
183
|
|
|
177
184
|
# Run filter
|
|
@@ -223,7 +230,7 @@ EOS
|
|
|
223
230
|
end
|
|
224
231
|
|
|
225
232
|
def test_colorize_syntax_with_default_colorizer
|
|
226
|
-
skip_unless_have_command
|
|
233
|
+
skip_unless_have_command 'pygmentize'
|
|
227
234
|
|
|
228
235
|
if_have 'nokogiri' do
|
|
229
236
|
# Create filter
|
|
@@ -252,13 +259,13 @@ EOS
|
|
|
252
259
|
input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
|
|
253
260
|
|
|
254
261
|
# Run filter
|
|
255
|
-
[
|
|
262
|
+
[:albino, :pygmentize, :simon_highlight].each do |colorizer|
|
|
256
263
|
begin
|
|
257
264
|
input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
|
|
258
265
|
filter.setup_and_run(
|
|
259
266
|
input,
|
|
260
267
|
:colorizers => { :ruby => colorizer })
|
|
261
|
-
flunk
|
|
268
|
+
flunk 'expected colorizer to raise if no executable is available'
|
|
262
269
|
rescue
|
|
263
270
|
end
|
|
264
271
|
end
|
|
@@ -361,7 +368,7 @@ EOS
|
|
|
361
368
|
filter = ::Nanoc::Filters::ColorizeSyntax.new
|
|
362
369
|
|
|
363
370
|
# Simple test
|
|
364
|
-
assert_equal
|
|
371
|
+
assert_equal ' bar', filter.send(:strip, "\n bar")
|
|
365
372
|
|
|
366
373
|
# Get input and expected output
|
|
367
374
|
input = <<EOS
|
data/test/filters/test_erb.rb
CHANGED
|
@@ -72,7 +72,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
|
|
|
72
72
|
|
|
73
73
|
# Set up
|
|
74
74
|
filter = ::Nanoc::Filters::ERB.new
|
|
75
|
-
File.open('moo', 'w') { |io| io.write(
|
|
75
|
+
File.open('moo', 'w') { |io| io.write('one miiillion dollars') }
|
|
76
76
|
|
|
77
77
|
# Without
|
|
78
78
|
res = filter.setup_and_run('<%= File.read("moo") %>', :safe_level => nil)
|
|
@@ -8,7 +8,7 @@ class Nanoc::Filters::KramdownTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::Kramdown.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
11
|
+
result = filter.setup_and_run('This is _so_ **cool**!')
|
|
12
12
|
assert_equal("<p>This is <em>so</em> <strong>cool</strong>!</p>\n", result)
|
|
13
13
|
end
|
|
14
14
|
end
|
data/test/filters/test_less.rb
CHANGED
|
@@ -5,10 +5,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
5
5
|
def test_filter
|
|
6
6
|
if_have 'less' do
|
|
7
7
|
# Create item
|
|
8
|
-
@item = Nanoc::Item.new(
|
|
8
|
+
@item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
|
9
9
|
|
|
10
10
|
# Create filter
|
|
11
|
-
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [
|
|
11
|
+
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
|
|
12
12
|
|
|
13
13
|
# Run filter
|
|
14
14
|
result = filter.setup_and_run('.foo { bar: 1 + 1 }')
|
|
@@ -23,10 +23,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
23
23
|
File.open('content/foo/bar/imported_file.less', 'w') { |io| io.write('p { color: red; }') }
|
|
24
24
|
|
|
25
25
|
# Create item
|
|
26
|
-
@item = Nanoc::Item.new(
|
|
26
|
+
@item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
|
27
27
|
|
|
28
28
|
# Create filter
|
|
29
|
-
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [
|
|
29
|
+
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
|
|
30
30
|
|
|
31
31
|
# Run filter
|
|
32
32
|
result = filter.setup_and_run('@import "content/foo/bar/imported_file.less";')
|
|
@@ -42,10 +42,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
42
42
|
|
|
43
43
|
# Create item
|
|
44
44
|
File.open('content/foo/bar.txt', 'w') { |io| io.write('meh') }
|
|
45
|
-
@item = Nanoc::Item.new(
|
|
45
|
+
@item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
|
46
46
|
|
|
47
47
|
# Create filter
|
|
48
|
-
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [
|
|
48
|
+
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
|
|
49
49
|
|
|
50
50
|
# Run filter
|
|
51
51
|
result = filter.setup_and_run('@import "bar/imported_file.less";')
|
|
@@ -62,7 +62,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
62
62
|
io.write('@import "b.less";')
|
|
63
63
|
end
|
|
64
64
|
File.open('content/b.less', 'w') do |io|
|
|
65
|
-
io.write(
|
|
65
|
+
io.write('p { color: red; }')
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# Update rules
|
|
@@ -92,7 +92,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
92
92
|
|
|
93
93
|
# Update included file
|
|
94
94
|
File.open('content/b.less', 'w') do |io|
|
|
95
|
-
io.write(
|
|
95
|
+
io.write('p { color: blue; }')
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
# Recompile
|
|
@@ -111,10 +111,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
111
111
|
def test_compression
|
|
112
112
|
if_have 'less' do
|
|
113
113
|
# Create item
|
|
114
|
-
@item = Nanoc::Item.new(
|
|
114
|
+
@item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
|
115
115
|
|
|
116
116
|
# Create filter
|
|
117
|
-
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [
|
|
117
|
+
filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
|
|
118
118
|
|
|
119
119
|
# Run filter with compress option
|
|
120
120
|
result = filter.setup_and_run('.foo { bar: a; } .bar { foo: b; }', :compress => true)
|
|
@@ -5,7 +5,7 @@ class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
|
|
|
5
5
|
def test_filter
|
|
6
6
|
# Don’t run this test on 1.9.x, because it breaks and it annoys me
|
|
7
7
|
if RUBY_VERSION >= '1.9'
|
|
8
|
-
skip
|
|
8
|
+
skip 'Markaby is not compatible with 1.9.x'
|
|
9
9
|
return
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -15,7 +15,7 @@ class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
|
|
|
15
15
|
|
|
16
16
|
# Run filter
|
|
17
17
|
result = filter.setup_and_run("html do\nend")
|
|
18
|
-
assert_equal(
|
|
18
|
+
assert_equal('<html></html>', result)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
data/test/filters/test_maruku.rb
CHANGED
|
@@ -8,8 +8,8 @@ class Nanoc::Filters::MarukuTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::Maruku.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
12
|
-
assert_equal(
|
|
11
|
+
result = filter.setup_and_run('This is _so_ *cool*!')
|
|
12
|
+
assert_equal('<p>This is <em>so</em> <em>cool</em>!</p>', result.strip)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
data/test/filters/test_pandoc.rb
CHANGED
|
@@ -4,7 +4,7 @@ class Nanoc::Filters::PandocTest < Nanoc::TestCase
|
|
|
4
4
|
|
|
5
5
|
def test_filter
|
|
6
6
|
if_have 'pandoc-ruby' do
|
|
7
|
-
skip_unless_have_command
|
|
7
|
+
skip_unless_have_command 'pandoc'
|
|
8
8
|
|
|
9
9
|
# Create filter
|
|
10
10
|
filter = ::Nanoc::Filters::Pandoc.new
|
|
@@ -17,13 +17,13 @@ class Nanoc::Filters::PandocTest < Nanoc::TestCase
|
|
|
17
17
|
|
|
18
18
|
def test_params
|
|
19
19
|
if_have 'pandoc-ruby' do
|
|
20
|
-
skip_unless_have_command
|
|
20
|
+
skip_unless_have_command 'pandoc'
|
|
21
21
|
|
|
22
22
|
# Create filter
|
|
23
23
|
filter = ::Nanoc::Filters::Pandoc.new
|
|
24
24
|
|
|
25
25
|
# Run filter
|
|
26
|
-
opts = [
|
|
26
|
+
opts = [:s, {:f => :markdown, :to => :html}, 'no-wrap', :toc]
|
|
27
27
|
result = filter.setup_and_run("# Heading\n", *opts)
|
|
28
28
|
assert_match '<div id="TOC">', result
|
|
29
29
|
assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
|
|
@@ -8,8 +8,8 @@ class Nanoc::Filters::RainpressTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::Rainpress.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
12
|
-
assert_equal(
|
|
11
|
+
result = filter.setup_and_run('body { color: black; }')
|
|
12
|
+
assert_equal('body{color:#000}', result)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -19,8 +19,8 @@ class Nanoc::Filters::RainpressTest < Nanoc::TestCase
|
|
|
19
19
|
filter = ::Nanoc::Filters::Rainpress.new
|
|
20
20
|
|
|
21
21
|
# Run filter
|
|
22
|
-
result = filter.setup_and_run(
|
|
23
|
-
assert_equal(
|
|
22
|
+
result = filter.setup_and_run('body { color: #aabbcc; }', :colors => false)
|
|
23
|
+
assert_equal('body{color:#aabbcc}', result)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|