nanoc 3.7.4 → 3.7.5
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 +19 -18
- data/LICENSE +1 -1
- data/NEWS.md +14 -0
- data/Rakefile +1 -1
- data/doc/yardoc_handlers/identifier.rb +1 -5
- data/lib/nanoc.rb +1 -3
- data/lib/nanoc/base.rb +1 -4
- data/lib/nanoc/base/checksummer.rb +10 -12
- data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
- data/lib/nanoc/base/compilation/compiler.rb +27 -31
- data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
- data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
- data/lib/nanoc/base/compilation/filter.rb +1 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -5
- data/lib/nanoc/base/compilation/rule_context.rb +7 -11
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
- data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
- data/lib/nanoc/base/context.rb +0 -3
- data/lib/nanoc/base/core_ext.rb +0 -1
- data/lib/nanoc/base/core_ext/array.rb +0 -2
- data/lib/nanoc/base/core_ext/hash.rb +0 -2
- data/lib/nanoc/base/core_ext/pathname.rb +0 -2
- data/lib/nanoc/base/core_ext/string.rb +0 -2
- data/lib/nanoc/base/directed_graph.rb +0 -4
- data/lib/nanoc/base/errors.rb +1 -39
- data/lib/nanoc/base/memoization.rb +0 -4
- data/lib/nanoc/base/notification_center.rb +1 -7
- data/lib/nanoc/base/plugin_registry.rb +4 -10
- data/lib/nanoc/base/result_data/item_rep.rb +8 -16
- data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
- data/lib/nanoc/base/source_data/configuration.rb +0 -4
- data/lib/nanoc/base/source_data/data_source.rb +2 -5
- data/lib/nanoc/base/source_data/item.rb +3 -7
- data/lib/nanoc/base/source_data/item_array.rb +1 -5
- data/lib/nanoc/base/source_data/layout.rb +2 -6
- data/lib/nanoc/base/source_data/site.rb +20 -23
- data/lib/nanoc/base/store.rb +1 -5
- data/lib/nanoc/base/temp_filename_factory.rb +0 -4
- data/lib/nanoc/cli.rb +3 -5
- data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
- data/lib/nanoc/cli/cleaning_stream.rb +2 -6
- data/lib/nanoc/cli/command_runner.rb +1 -5
- data/lib/nanoc/cli/commands/autocompile.rb +2 -6
- data/lib/nanoc/cli/commands/check.rb +0 -4
- data/lib/nanoc/cli/commands/compile.rb +12 -27
- data/lib/nanoc/cli/commands/create-item.rb +1 -5
- data/lib/nanoc/cli/commands/create-layout.rb +0 -4
- data/lib/nanoc/cli/commands/create-site.rb +2 -8
- data/lib/nanoc/cli/commands/deploy.rb +3 -7
- data/lib/nanoc/cli/commands/prune.rb +2 -6
- data/lib/nanoc/cli/commands/shell.rb +4 -8
- data/lib/nanoc/cli/commands/show-data.rb +3 -7
- data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
- data/lib/nanoc/cli/commands/show-rules.rb +11 -15
- data/lib/nanoc/cli/commands/sync.rb +0 -4
- data/lib/nanoc/cli/commands/update.rb +1 -7
- data/lib/nanoc/cli/commands/validate-css.rb +0 -4
- data/lib/nanoc/cli/commands/validate-html.rb +0 -4
- data/lib/nanoc/cli/commands/validate-links.rb +0 -4
- data/lib/nanoc/cli/commands/view.rb +3 -7
- data/lib/nanoc/cli/commands/watch.rb +4 -10
- data/lib/nanoc/cli/error_handler.rb +9 -13
- data/lib/nanoc/cli/logger.rb +8 -12
- data/lib/nanoc/cli/stream_cleaners.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
- data/lib/nanoc/data_sources.rb +2 -4
- data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
- data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
- data/lib/nanoc/data_sources/filesystem.rb +10 -13
- data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
- data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
- data/lib/nanoc/data_sources/static.rb +4 -8
- data/lib/nanoc/extra.rb +2 -4
- data/lib/nanoc/extra/auto_compiler.rb +2 -6
- data/lib/nanoc/extra/checking.rb +0 -4
- data/lib/nanoc/extra/checking/check.rb +0 -4
- data/lib/nanoc/extra/checking/checks.rb +0 -2
- data/lib/nanoc/extra/checking/checks/css.rb +6 -6
- data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
- data/lib/nanoc/extra/checking/checks/html.rb +6 -6
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
- data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
- data/lib/nanoc/extra/checking/dsl.rb +0 -4
- data/lib/nanoc/extra/checking/issue.rb +0 -4
- data/lib/nanoc/extra/checking/runner.rb +4 -7
- data/lib/nanoc/extra/chick.rb +7 -17
- data/lib/nanoc/extra/core_ext.rb +0 -1
- data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
- data/lib/nanoc/extra/core_ext/time.rb +0 -2
- data/lib/nanoc/extra/deployer.rb +0 -4
- data/lib/nanoc/extra/deployers.rb +0 -4
- data/lib/nanoc/extra/deployers/fog.rb +7 -11
- data/lib/nanoc/extra/deployers/rsync.rb +1 -5
- data/lib/nanoc/extra/file_proxy.rb +1 -5
- data/lib/nanoc/extra/filesystem_tools.rb +37 -12
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
- data/lib/nanoc/extra/link_collector.rb +3 -7
- data/lib/nanoc/extra/piper.rb +0 -6
- data/lib/nanoc/extra/pruner.rb +1 -7
- data/lib/nanoc/extra/validators.rb +0 -4
- data/lib/nanoc/extra/validators/links.rb +0 -4
- data/lib/nanoc/extra/validators/w3c.rb +0 -4
- data/lib/nanoc/extra/vcs.rb +3 -7
- data/lib/nanoc/extra/vcses.rb +0 -2
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
- data/lib/nanoc/extra/vcses/dummy.rb +0 -4
- data/lib/nanoc/extra/vcses/git.rb +0 -4
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
- data/lib/nanoc/extra/vcses/subversion.rb +0 -4
- data/lib/nanoc/filters.rb +0 -2
- data/lib/nanoc/filters/asciidoc.rb +1 -5
- data/lib/nanoc/filters/bluecloth.rb +0 -2
- data/lib/nanoc/filters/coderay.rb +0 -2
- data/lib/nanoc/filters/coffeescript.rb +0 -4
- data/lib/nanoc/filters/colorize_syntax.rb +17 -15
- data/lib/nanoc/filters/erb.rb +1 -3
- data/lib/nanoc/filters/erubis.rb +2 -4
- data/lib/nanoc/filters/haml.rb +2 -4
- data/lib/nanoc/filters/handlebars.rb +0 -4
- data/lib/nanoc/filters/kramdown.rb +7 -4
- data/lib/nanoc/filters/less.rb +1 -3
- data/lib/nanoc/filters/markaby.rb +0 -2
- data/lib/nanoc/filters/maruku.rb +0 -2
- data/lib/nanoc/filters/mustache.rb +1 -5
- data/lib/nanoc/filters/pandoc.rb +0 -2
- data/lib/nanoc/filters/rainpress.rb +0 -2
- data/lib/nanoc/filters/rdiscount.rb +0 -2
- data/lib/nanoc/filters/rdoc.rb +0 -2
- data/lib/nanoc/filters/redcarpet.rb +0 -4
- data/lib/nanoc/filters/redcloth.rb +0 -2
- data/lib/nanoc/filters/relativize_paths.rb +2 -4
- data/lib/nanoc/filters/rubypants.rb +0 -2
- data/lib/nanoc/filters/sass.rb +2 -4
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
- data/lib/nanoc/filters/slim.rb +2 -6
- data/lib/nanoc/filters/typogruby.rb +0 -4
- data/lib/nanoc/filters/uglify_js.rb +0 -2
- data/lib/nanoc/filters/xsl.rb +1 -5
- data/lib/nanoc/filters/yui_compressor.rb +0 -4
- data/lib/nanoc/helpers.rb +0 -2
- data/lib/nanoc/helpers/blogging.rb +12 -20
- data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
- data/lib/nanoc/helpers/capturing.rb +2 -10
- data/lib/nanoc/helpers/filtering.rb +0 -4
- data/lib/nanoc/helpers/html_escape.rb +3 -7
- data/lib/nanoc/helpers/link_to.rb +0 -4
- data/lib/nanoc/helpers/rendering.rb +8 -12
- data/lib/nanoc/helpers/tagging.rb +0 -4
- data/lib/nanoc/helpers/text.rb +1 -5
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
- data/lib/nanoc/tasks/clean.rb +1 -7
- data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
- data/lib/nanoc/tasks/validate.rake +0 -4
- data/lib/nanoc/version.rb +1 -3
- data/nanoc.gemspec +12 -9
- data/tasks/rubocop.rake +1 -1
- data/tasks/test.rake +6 -7
- data/test/base/checksummer_spec.rb +28 -44
- data/test/base/core_ext/array_spec.rb +1 -9
- data/test/base/core_ext/hash_spec.rb +7 -19
- data/test/base/core_ext/pathname_spec.rb +2 -4
- data/test/base/core_ext/string_spec.rb +0 -4
- data/test/base/temp_filename_factory_spec.rb +0 -8
- data/test/base/test_checksum_store.rb +0 -2
- data/test/base/test_code_snippet.rb +0 -2
- data/test/base/test_compiler.rb +15 -17
- data/test/base/test_compiler_dsl.rb +7 -9
- data/test/base/test_context.rb +2 -4
- data/test/base/test_data_source.rb +0 -2
- data/test/base/test_dependency_tracker.rb +0 -2
- data/test/base/test_directed_graph.rb +2 -4
- data/test/base/test_filter.rb +5 -7
- data/test/base/test_item.rb +17 -13
- data/test/base/test_item_array.rb +2 -4
- data/test/base/test_item_rep.rb +79 -73
- data/test/base/test_layout.rb +3 -5
- data/test/base/test_memoization.rb +13 -21
- data/test/base/test_notification_center.rb +0 -2
- data/test/base/test_outdatedness_checker.rb +34 -36
- data/test/base/test_plugin.rb +0 -2
- data/test/base/test_rule.rb +3 -5
- data/test/base/test_rule_context.rb +4 -6
- data/test/base/test_site.rb +9 -17
- data/test/base/test_store.rb +2 -6
- data/test/cli/commands/test_check.rb +1 -3
- data/test/cli/commands/test_compile.rb +24 -15
- data/test/cli/commands/test_create_item.rb +1 -3
- data/test/cli/commands/test_create_layout.rb +0 -2
- data/test/cli/commands/test_create_site.rb +0 -3
- data/test/cli/commands/test_deploy.rb +9 -11
- data/test/cli/commands/test_help.rb +0 -2
- data/test/cli/commands/test_info.rb +0 -2
- data/test/cli/commands/test_prune.rb +6 -8
- data/test/cli/commands/test_sync.rb +0 -2
- data/test/cli/commands/test_update.rb +0 -2
- data/test/cli/commands/test_watch.rb +4 -6
- data/test/cli/test_cleaning_stream.rb +4 -6
- data/test/cli/test_cli.rb +9 -5
- data/test/cli/test_error_handler.rb +9 -7
- data/test/cli/test_logger.rb +0 -2
- data/test/data_sources/test_filesystem.rb +8 -10
- data/test/data_sources/test_filesystem_unified.rb +35 -34
- data/test/data_sources/test_filesystem_verbose.rb +31 -33
- data/test/data_sources/test_static.rb +20 -21
- data/test/extra/checking/checks/test_css.rb +23 -2
- data/test/extra/checking/checks/test_external_links.rb +2 -4
- data/test/extra/checking/checks/test_html.rb +4 -3
- data/test/extra/checking/checks/test_internal_links.rb +1 -3
- data/test/extra/checking/checks/test_stale.rb +4 -6
- data/test/extra/checking/test_check.rb +0 -2
- data/test/extra/checking/test_dsl.rb +1 -3
- data/test/extra/checking/test_runner.rb +0 -2
- data/test/extra/core_ext/test_pathname.rb +0 -3
- data/test/extra/core_ext/test_time.rb +0 -2
- data/test/extra/deployers/test_fog.rb +13 -15
- data/test/extra/deployers/test_rsync.rb +4 -6
- data/test/extra/test_auto_compiler.rb +47 -25
- data/test/extra/test_file_proxy.rb +1 -3
- data/test/extra/test_filesystem_tools.rb +47 -7
- data/test/extra/test_link_collector.rb +0 -2
- data/test/extra/test_piper.rb +3 -5
- data/test/extra/test_vcs.rb +0 -2
- data/test/extra/validators/test_links.rb +0 -1
- data/test/extra/validators/test_w3c.rb +2 -4
- data/test/filters/test_asciidoc.rb +0 -2
- data/test/filters/test_bluecloth.rb +0 -2
- data/test/filters/test_coderay.rb +2 -4
- data/test/filters/test_coffeescript.rb +0 -2
- data/test/filters/test_colorize_syntax.rb +16 -18
- data/test/filters/test_erb.rb +12 -14
- data/test/filters/test_erubis.rb +4 -6
- data/test/filters/test_haml.rb +7 -9
- data/test/filters/test_handlebars.rb +10 -12
- data/test/filters/test_kramdown.rb +13 -1
- data/test/filters/test_less.rb +9 -11
- data/test/filters/test_markaby.rb +0 -2
- data/test/filters/test_maruku.rb +0 -2
- data/test/filters/test_mustache.rb +4 -6
- data/test/filters/test_pandoc.rb +1 -3
- data/test/filters/test_rainpress.rb +1 -3
- data/test/filters/test_rdiscount.rb +1 -3
- data/test/filters/test_rdoc.rb +0 -2
- data/test/filters/test_redcarpet.rb +6 -8
- data/test/filters/test_redcloth.rb +1 -3
- data/test/filters/test_relativize_paths.rb +29 -34
- data/test/filters/test_rubypants.rb +0 -2
- data/test/filters/test_sass.rb +8 -10
- data/test/filters/test_slim.rb +2 -4
- data/test/filters/test_typogruby.rb +0 -3
- data/test/filters/test_uglify_js.rb +2 -4
- data/test/filters/test_xsl.rb +16 -18
- data/test/filters/test_yui_compressor.rb +3 -5
- data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +11 -15
- data/test/helpers/test_blogging.rb +61 -63
- data/test/helpers/test_breadcrumbs.rb +0 -2
- data/test/helpers/test_capturing.rb +4 -6
- data/test/helpers/test_filtering.rb +2 -4
- data/test/helpers/test_html_escape.rb +0 -2
- data/test/helpers/test_link_to.rb +5 -6
- data/test/helpers/test_rendering.rb +2 -4
- data/test/helpers/test_tagging.rb +9 -11
- data/test/helpers/test_text.rb +6 -8
- data/test/helpers/test_xml_sitemap.rb +11 -13
- data/test/tasks/test_clean.rb +0 -2
- data/test/test_gem.rb +1 -3
- metadata +15 -14
- data/Gemfile.lock +0 -252
- data/lib/nanoc/base/core_ext/date.rb +0 -29
- data/lib/nanoc/base/ordered_hash.rb +0 -228
- data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
- data/test/base/core_ext/date_spec.rb +0 -15
- data/test/extra/core_ext/test_enumerable.rb +0 -28
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::HandlebarsTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'handlebars' do
|
|
7
6
|
# Create data
|
|
8
7
|
item = Nanoc::Item.new(
|
|
9
8
|
'content',
|
|
10
|
-
{ :
|
|
9
|
+
{ title: 'Max Payne', protagonist: 'Max Payne', location: 'here' },
|
|
11
10
|
'/games/max-payne/')
|
|
12
11
|
layout = Nanoc::Layout.new(
|
|
13
12
|
'layout content',
|
|
14
|
-
{ :
|
|
13
|
+
{ name: 'Max Payne' },
|
|
15
14
|
'/default/')
|
|
16
|
-
config = { :
|
|
15
|
+
config = { animals: 'cats and dogs' }
|
|
17
16
|
|
|
18
17
|
# Create filter
|
|
19
18
|
assigns = {
|
|
20
|
-
:
|
|
21
|
-
:
|
|
22
|
-
:
|
|
23
|
-
:
|
|
19
|
+
item: item,
|
|
20
|
+
layout: layout,
|
|
21
|
+
config: config,
|
|
22
|
+
content: 'No Payne No Gayne'
|
|
24
23
|
}
|
|
25
24
|
filter = ::Nanoc::Filters::Handlebars.new(assigns)
|
|
26
25
|
|
|
@@ -39,13 +38,13 @@ class Nanoc::Filters::HandlebarsTest < Nanoc::TestCase
|
|
|
39
38
|
# Create data
|
|
40
39
|
item = Nanoc::Item.new(
|
|
41
40
|
'content',
|
|
42
|
-
{ :
|
|
41
|
+
{ title: 'Max Payne', protagonist: 'Max Payne', location: 'here' },
|
|
43
42
|
'/games/max-payne/')
|
|
44
43
|
|
|
45
44
|
# Create filter
|
|
46
45
|
assigns = {
|
|
47
|
-
:
|
|
48
|
-
:
|
|
46
|
+
item: item,
|
|
47
|
+
content: 'No Payne No Gayne'
|
|
49
48
|
}
|
|
50
49
|
filter = ::Nanoc::Filters::Handlebars.new(assigns)
|
|
51
50
|
|
|
@@ -54,5 +53,4 @@ class Nanoc::Filters::HandlebarsTest < Nanoc::TestCase
|
|
|
54
53
|
assert_equal('Max Payne says: No Payne No Gayne.', result)
|
|
55
54
|
end
|
|
56
55
|
end
|
|
57
|
-
|
|
58
56
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::KramdownTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'kramdown' do
|
|
7
6
|
# Create filter
|
|
@@ -13,4 +12,17 @@ class Nanoc::Filters::KramdownTest < Nanoc::TestCase
|
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
14
|
|
|
15
|
+
def test_warnings
|
|
16
|
+
if_have 'kramdown' do
|
|
17
|
+
# Create filter
|
|
18
|
+
filter = ::Nanoc::Filters::Kramdown.new
|
|
19
|
+
|
|
20
|
+
# Run filter
|
|
21
|
+
io = capturing_stdio do
|
|
22
|
+
filter.setup_and_run('{:foo}this is bogus')
|
|
23
|
+
end
|
|
24
|
+
assert_empty io[:stdout]
|
|
25
|
+
assert_equal "kramdown warning: Found span IAL after text - ignoring it\n", io[:stderr]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
16
28
|
end
|
data/test/filters/test_less.rb
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'less' do
|
|
7
6
|
# Create item
|
|
8
|
-
@item = Nanoc::Item.new('blah', { :
|
|
7
|
+
@item = Nanoc::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/')
|
|
9
8
|
|
|
10
9
|
# Create filter
|
|
11
|
-
filter = ::Nanoc::Filters::Less.new(:
|
|
10
|
+
filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
|
|
12
11
|
|
|
13
12
|
# Run filter
|
|
14
13
|
result = filter.setup_and_run('.foo { bar: 1 + 1 }')
|
|
@@ -23,10 +22,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
23
22
|
File.open('content/foo/bar/imported_file.less', 'w') { |io| io.write('p { color: red; }') }
|
|
24
23
|
|
|
25
24
|
# Create item
|
|
26
|
-
@item = Nanoc::Item.new('blah', { :
|
|
25
|
+
@item = Nanoc::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/')
|
|
27
26
|
|
|
28
27
|
# Create filter
|
|
29
|
-
filter = ::Nanoc::Filters::Less.new(:
|
|
28
|
+
filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
|
|
30
29
|
|
|
31
30
|
# Run filter
|
|
32
31
|
result = filter.setup_and_run('@import "content/foo/bar/imported_file.less";')
|
|
@@ -42,10 +41,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
42
41
|
|
|
43
42
|
# Create item
|
|
44
43
|
File.open('content/foo/bar.txt', 'w') { |io| io.write('meh') }
|
|
45
|
-
@item = Nanoc::Item.new('blah', { :
|
|
44
|
+
@item = Nanoc::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/')
|
|
46
45
|
|
|
47
46
|
# Create filter
|
|
48
|
-
filter = ::Nanoc::Filters::Less.new(:
|
|
47
|
+
filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
|
|
49
48
|
|
|
50
49
|
# Run filter
|
|
51
50
|
result = filter.setup_and_run('@import "bar/imported_file.less";')
|
|
@@ -111,15 +110,14 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
|
|
|
111
110
|
def test_compression
|
|
112
111
|
if_have 'less' do
|
|
113
112
|
# Create item
|
|
114
|
-
@item = Nanoc::Item.new('blah', { :
|
|
113
|
+
@item = Nanoc::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/')
|
|
115
114
|
|
|
116
115
|
# Create filter
|
|
117
|
-
filter = ::Nanoc::Filters::Less.new(:
|
|
116
|
+
filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
|
|
118
117
|
|
|
119
118
|
# Run filter with compress option
|
|
120
|
-
result = filter.setup_and_run('.foo { bar: a; } .bar { foo: b; }', :
|
|
119
|
+
result = filter.setup_and_run('.foo { bar: a; } .bar { foo: b; }', compress: true)
|
|
121
120
|
assert_match(/^\.foo\{bar:a\}\n?\.bar\{foo:b\}/, result)
|
|
122
121
|
end
|
|
123
122
|
end
|
|
124
|
-
|
|
125
123
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
# Don’t run this test on 1.9.x, because it breaks and it annoys me
|
|
7
6
|
if RUBY_VERSION >= '1.9'
|
|
@@ -18,5 +17,4 @@ class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
|
|
|
18
17
|
assert_equal('<html></html>', result)
|
|
19
18
|
end
|
|
20
19
|
end
|
|
21
|
-
|
|
22
20
|
end
|
data/test/filters/test_maruku.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::MarukuTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'maruku' do
|
|
7
6
|
# Create filter
|
|
@@ -12,5 +11,4 @@ class Nanoc::Filters::MarukuTest < Nanoc::TestCase
|
|
|
12
11
|
assert_equal('<p>This is <em>so</em> <em>cool</em>!</p>', result.strip)
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
|
-
|
|
16
14
|
end
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::MustacheTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'mustache' do
|
|
7
6
|
# Create item
|
|
8
7
|
item = Nanoc::Item.new(
|
|
9
8
|
'content',
|
|
10
|
-
{ :
|
|
9
|
+
{ title: 'Max Payne', protagonist: 'Max Payne' },
|
|
11
10
|
'/games/max-payne/'
|
|
12
11
|
)
|
|
13
12
|
|
|
14
13
|
# Create filter
|
|
15
|
-
filter = ::Nanoc::Filters::Mustache.new({ :
|
|
14
|
+
filter = ::Nanoc::Filters::Mustache.new({ item: item })
|
|
16
15
|
|
|
17
16
|
# Run filter
|
|
18
17
|
result = filter.setup_and_run('The protagonist of {{title}} is {{protagonist}}.')
|
|
@@ -25,18 +24,17 @@ class Nanoc::Filters::MustacheTest < Nanoc::TestCase
|
|
|
25
24
|
# Create item
|
|
26
25
|
item = Nanoc::Item.new(
|
|
27
26
|
'content',
|
|
28
|
-
{ :
|
|
27
|
+
{ title: 'Max Payne', protagonist: 'Max Payne' },
|
|
29
28
|
'/games/max-payne/'
|
|
30
29
|
)
|
|
31
30
|
|
|
32
31
|
# Create filter
|
|
33
32
|
filter = ::Nanoc::Filters::Mustache.new(
|
|
34
|
-
{ :
|
|
33
|
+
{ content: 'No Payne No Gayne', item: item })
|
|
35
34
|
|
|
36
35
|
# Run filter
|
|
37
36
|
result = filter.setup_and_run('Max says: {{yield}}.')
|
|
38
37
|
assert_equal('Max says: No Payne No Gayne.', result)
|
|
39
38
|
end
|
|
40
39
|
end
|
|
41
|
-
|
|
42
40
|
end
|
data/test/filters/test_pandoc.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::PandocTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'pandoc-ruby' do
|
|
7
6
|
skip_unless_have_command 'pandoc'
|
|
@@ -23,11 +22,10 @@ class Nanoc::Filters::PandocTest < Nanoc::TestCase
|
|
|
23
22
|
filter = ::Nanoc::Filters::Pandoc.new
|
|
24
23
|
|
|
25
24
|
# Run filter
|
|
26
|
-
opts = [:s, {:
|
|
25
|
+
opts = [:s, { f: :markdown, to: :html }, 'no-wrap', :toc]
|
|
27
26
|
result = filter.setup_and_run("# Heading\n", *opts)
|
|
28
27
|
assert_match '<div id="TOC">', result
|
|
29
28
|
assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
|
-
|
|
33
31
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::RainpressTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'rainpress' do
|
|
7
6
|
# Create filter
|
|
@@ -19,9 +18,8 @@ class Nanoc::Filters::RainpressTest < Nanoc::TestCase
|
|
|
19
18
|
filter = ::Nanoc::Filters::Rainpress.new
|
|
20
19
|
|
|
21
20
|
# Run filter
|
|
22
|
-
result = filter.setup_and_run('body { color: #aabbcc; }', :
|
|
21
|
+
result = filter.setup_and_run('body { color: #aabbcc; }', colors: false)
|
|
23
22
|
assert_equal('body{color:#aabbcc}', result)
|
|
24
23
|
end
|
|
25
24
|
end
|
|
26
|
-
|
|
27
25
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::RDiscountTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'rdiscount' do
|
|
7
6
|
# Create filter
|
|
@@ -21,9 +20,8 @@ class Nanoc::Filters::RDiscountTest < Nanoc::TestCase
|
|
|
21
20
|
# Run filter
|
|
22
21
|
input = "The quotation 'marks' sure make this look sarcastic!"
|
|
23
22
|
output_expected = /The quotation ‘marks’ sure make this look sarcastic!/
|
|
24
|
-
output_actual = filter.setup_and_run(input, :
|
|
23
|
+
output_actual = filter.setup_and_run(input, extensions: [:smart])
|
|
25
24
|
assert_match(output_expected, output_actual)
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
|
-
|
|
29
27
|
end
|
data/test/filters/test_rdoc.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::RDocTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
# Get filter
|
|
7
6
|
filter = ::Nanoc::Filters::RDoc.new
|
|
@@ -10,5 +9,4 @@ class Nanoc::Filters::RDocTest < Nanoc::TestCase
|
|
|
10
9
|
result = filter.setup_and_run('= Foo')
|
|
11
10
|
assert_match(%r{\A\s*<h1( id="label-Foo")?>Foo(<span>.*</span>)?</h1>\s*\Z}, result)
|
|
12
11
|
end
|
|
13
|
-
|
|
14
12
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_find
|
|
6
5
|
if_have 'redcarpet' do
|
|
7
6
|
refute Nanoc::Filter.named(:redcarpet).nil?
|
|
@@ -28,11 +27,11 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
28
27
|
if ::Redcarpet::VERSION > '2'
|
|
29
28
|
input = 'this is ~~good~~ bad'
|
|
30
29
|
output_expected = /this is <del>good<\/del> bad/
|
|
31
|
-
output_actual = filter.setup_and_run(input, :
|
|
30
|
+
output_actual = filter.setup_and_run(input, options: { strikethrough: true })
|
|
32
31
|
else
|
|
33
32
|
input = "The quotation 'marks' sure make this look sarcastic!"
|
|
34
33
|
output_expected = /The quotation ‘marks’ sure make this look sarcastic!/
|
|
35
|
-
output_actual = filter.setup_and_run(input, :
|
|
34
|
+
output_actual = filter.setup_and_run(input, options: [:smart])
|
|
36
35
|
end
|
|
37
36
|
assert_match(output_expected, output_actual)
|
|
38
37
|
end
|
|
@@ -60,9 +59,9 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
60
59
|
input = ""
|
|
61
60
|
output_expected = %r{<img src="/path/to/img" alt="Alt" title="Title"/>}
|
|
62
61
|
if ::Redcarpet::VERSION > '2'
|
|
63
|
-
output_actual = filter.setup_and_run(input, :
|
|
62
|
+
output_actual = filter.setup_and_run(input, renderer_options: { xhtml: true })
|
|
64
63
|
else
|
|
65
|
-
output_actual = filter.setup_and_run(input, :
|
|
64
|
+
output_actual = filter.setup_and_run(input, options: [:xhtml])
|
|
66
65
|
end
|
|
67
66
|
assert_match(output_expected, output_actual)
|
|
68
67
|
end
|
|
@@ -79,7 +78,7 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
79
78
|
|
|
80
79
|
# Run filter
|
|
81
80
|
input = "# Heading 1\n## Heading 2\n"
|
|
82
|
-
output_actual = filter.run(input, :
|
|
81
|
+
output_actual = filter.run(input, renderer: Redcarpet::Render::HTML_TOC)
|
|
83
82
|
|
|
84
83
|
# Test
|
|
85
84
|
output_expected = %r{<ul>\n<li>\n<a href=\"#heading-1\">Heading 1</a>\n<ul>\n<li>\n<a href=\"#heading-2\">Heading 2</a>\n</li>\n</ul>\n</li>\n</ul>}
|
|
@@ -96,7 +95,7 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
96
95
|
input = "A Title\n======"
|
|
97
96
|
if ::Redcarpet::VERSION > '2'
|
|
98
97
|
output_expected = %r{<ul>\n<li>\n<a href="#a-title">A Title</a>\n</li>\n</ul>\n<h1 id="a-title">A Title</h1>\n}
|
|
99
|
-
output_actual = filter.setup_and_run(input, :
|
|
98
|
+
output_actual = filter.setup_and_run(input, with_toc: true)
|
|
100
99
|
else
|
|
101
100
|
output_expected = %r{<h1>A Title</h1>\n}
|
|
102
101
|
output_actual = filter.setup_and_run(input)
|
|
@@ -106,5 +105,4 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
106
105
|
assert_match(output_expected, output_actual)
|
|
107
106
|
end
|
|
108
107
|
end
|
|
109
|
-
|
|
110
108
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::RedClothTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_filter
|
|
6
5
|
if_have 'redcloth' do
|
|
7
6
|
# Get filter
|
|
@@ -23,9 +22,8 @@ class Nanoc::Filters::RedClothTest < Nanoc::TestCase
|
|
|
23
22
|
assert_equal("<p>I am a member of <span class=\"caps\">SPECTRE</span>.</p>", result)
|
|
24
23
|
|
|
25
24
|
# Run filter with options
|
|
26
|
-
result = filter.setup_and_run('I am a member of SPECTRE.', :
|
|
25
|
+
result = filter.setup_and_run('I am a member of SPECTRE.', no_span_caps: true)
|
|
27
26
|
assert_equal('<p>I am a member of SPECTRE.</p>', result)
|
|
28
27
|
end
|
|
29
28
|
end
|
|
30
|
-
|
|
31
29
|
end
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
|
-
|
|
6
4
|
def test_filter_html_with_double_quotes
|
|
7
5
|
# Create filter with mock item
|
|
8
6
|
filter = Nanoc::Filters::RelativizePaths.new
|
|
@@ -23,7 +21,7 @@ class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
|
23
21
|
expected_content = %(<a href="../..">foo</a>)
|
|
24
22
|
|
|
25
23
|
# Test
|
|
26
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
24
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
27
25
|
assert_equal(expected_content, actual_content)
|
|
28
26
|
end
|
|
29
27
|
|
|
@@ -47,7 +45,7 @@ class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
|
47
45
|
expected_content = %(<a href="../..">foo</a>)
|
|
48
46
|
|
|
49
47
|
# Test
|
|
50
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
48
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
51
49
|
assert_equal(expected_content, actual_content)
|
|
52
50
|
end
|
|
53
51
|
|
|
@@ -71,7 +69,7 @@ class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
|
71
69
|
expected_content = %(<a href="../..">foo</a>)
|
|
72
70
|
|
|
73
71
|
# Test
|
|
74
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
72
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
75
73
|
assert_equal(expected_content, actual_content)
|
|
76
74
|
end
|
|
77
75
|
|
|
@@ -106,7 +104,7 @@ EOS
|
|
|
106
104
|
expected_match_1 = %r{\A\s*<!DOCTYPE html\s*>\s*<html>\s*<head>(.|\s)*<title>Hello</title>\s*</head>\s*<body>\s*<a href="../..">foo</a>\s*</body>\s*</html>\s*\Z}m
|
|
107
105
|
|
|
108
106
|
# Test
|
|
109
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
107
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
110
108
|
assert_match(expected_match_0, actual_content)
|
|
111
109
|
assert_match(expected_match_1, actual_content)
|
|
112
110
|
end
|
|
@@ -131,7 +129,7 @@ EOS
|
|
|
131
129
|
expected_content = %(<a href="../..">foo</a> <a href="../../../bar">bar</a>)
|
|
132
130
|
|
|
133
131
|
# Test
|
|
134
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
132
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
135
133
|
assert_equal(expected_content, actual_content)
|
|
136
134
|
end
|
|
137
135
|
|
|
@@ -155,7 +153,7 @@ EOS
|
|
|
155
153
|
expected_content = %(<a href="../../../"><img src="../../../bar.png"></a>)
|
|
156
154
|
|
|
157
155
|
# Test
|
|
158
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
156
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
159
157
|
assert_equal(expected_content, actual_content)
|
|
160
158
|
end
|
|
161
159
|
|
|
@@ -179,7 +177,7 @@ EOS
|
|
|
179
177
|
expected_content = %(stuff href="/foo" more stuff)
|
|
180
178
|
|
|
181
179
|
# Test
|
|
182
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
180
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
183
181
|
assert_equal(expected_content, actual_content)
|
|
184
182
|
end
|
|
185
183
|
|
|
@@ -203,7 +201,7 @@ EOS
|
|
|
203
201
|
expected_content = %(<a href="../../">foo</a>)
|
|
204
202
|
|
|
205
203
|
# Test
|
|
206
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
204
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
207
205
|
assert_equal(expected_content, actual_content)
|
|
208
206
|
end
|
|
209
207
|
|
|
@@ -227,7 +225,7 @@ EOS
|
|
|
227
225
|
expected_content = %(<a href="//example.com/">example.com</a>)
|
|
228
226
|
|
|
229
227
|
# Test
|
|
230
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
228
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
231
229
|
assert_equal(expected_content, actual_content)
|
|
232
230
|
end
|
|
233
231
|
|
|
@@ -251,7 +249,7 @@ EOS
|
|
|
251
249
|
expected_content = %(<a href="#max-payne">Max Payne</a>)
|
|
252
250
|
|
|
253
251
|
# Test
|
|
254
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
252
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
255
253
|
assert_equal(expected_content, actual_content)
|
|
256
254
|
end
|
|
257
255
|
|
|
@@ -275,7 +273,7 @@ EOS
|
|
|
275
273
|
expected_content = %(<a href="http://example.com/">Example</a>)
|
|
276
274
|
|
|
277
275
|
# Test
|
|
278
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
276
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
279
277
|
assert_equal(expected_content, actual_content)
|
|
280
278
|
end
|
|
281
279
|
|
|
@@ -299,7 +297,7 @@ EOS
|
|
|
299
297
|
expected_content = %(<a href="example">Example</a>)
|
|
300
298
|
|
|
301
299
|
# Test
|
|
302
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
300
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
303
301
|
assert_equal(expected_content, actual_content)
|
|
304
302
|
end
|
|
305
303
|
|
|
@@ -319,13 +317,12 @@ EOS
|
|
|
319
317
|
end
|
|
320
318
|
|
|
321
319
|
raw_content = %(<object data="/example"><param name="movie" content="/example"></object>)
|
|
322
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
320
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
323
321
|
|
|
324
322
|
assert_match(/<object data="..\/..\/example">/, actual_content)
|
|
325
323
|
assert_match(/<param (name="movie" )?content="..\/..\/example"/, actual_content)
|
|
326
324
|
end
|
|
327
325
|
|
|
328
|
-
|
|
329
326
|
def test_filter_implicit
|
|
330
327
|
# Create filter with mock item
|
|
331
328
|
filter = Nanoc::Filters::RelativizePaths.new
|
|
@@ -356,7 +353,7 @@ EOS
|
|
|
356
353
|
expected_content = %[background: url("../background.png");]
|
|
357
354
|
|
|
358
355
|
# Test
|
|
359
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
356
|
+
actual_content = filter.setup_and_run(raw_content, type: :css)
|
|
360
357
|
assert_equal(expected_content, actual_content)
|
|
361
358
|
end
|
|
362
359
|
|
|
@@ -380,7 +377,7 @@ EOS
|
|
|
380
377
|
expected_content = %[background: url('../background.png');]
|
|
381
378
|
|
|
382
379
|
# Test
|
|
383
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
380
|
+
actual_content = filter.setup_and_run(raw_content, type: :css)
|
|
384
381
|
assert_equal(expected_content, actual_content)
|
|
385
382
|
end
|
|
386
383
|
|
|
@@ -404,7 +401,7 @@ EOS
|
|
|
404
401
|
expected_content = %[background: url(../background.png);]
|
|
405
402
|
|
|
406
403
|
# Test
|
|
407
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
404
|
+
actual_content = filter.setup_and_run(raw_content, type: :css)
|
|
408
405
|
assert_equal(expected_content, actual_content)
|
|
409
406
|
end
|
|
410
407
|
|
|
@@ -428,7 +425,7 @@ EOS
|
|
|
428
425
|
expected_content = %[background: url(../a.png) url(../b.png);]
|
|
429
426
|
|
|
430
427
|
# Test
|
|
431
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
428
|
+
actual_content = filter.setup_and_run(raw_content, type: :css)
|
|
432
429
|
assert_equal(expected_content, actual_content)
|
|
433
430
|
end
|
|
434
431
|
|
|
@@ -455,7 +452,7 @@ EOS
|
|
|
455
452
|
expected_content = %[background: url(../../);]
|
|
456
453
|
|
|
457
454
|
# Test
|
|
458
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
455
|
+
actual_content = filter.setup_and_run(raw_content, type: :css)
|
|
459
456
|
assert_equal(expected_content, actual_content)
|
|
460
457
|
end
|
|
461
458
|
|
|
@@ -479,7 +476,7 @@ EOS
|
|
|
479
476
|
expected_content = %[background: url(//example.com);]
|
|
480
477
|
|
|
481
478
|
# Test
|
|
482
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
479
|
+
actual_content = filter.setup_and_run(raw_content, type: :css)
|
|
483
480
|
assert_equal(expected_content, actual_content)
|
|
484
481
|
end
|
|
485
482
|
|
|
@@ -508,7 +505,7 @@ EOS
|
|
|
508
505
|
</foo>
|
|
509
506
|
XML
|
|
510
507
|
|
|
511
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
508
|
+
actual_content = filter.setup_and_run(raw_content, type: :xml, select: ['*/@boo'])
|
|
512
509
|
|
|
513
510
|
assert_match(expected, actual_content)
|
|
514
511
|
end
|
|
@@ -537,7 +534,7 @@ XML
|
|
|
537
534
|
</foo>
|
|
538
535
|
XML
|
|
539
536
|
|
|
540
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
537
|
+
actual_content = filter.setup_and_run(raw_content, type: :xml, select: ['far/@href'])
|
|
541
538
|
|
|
542
539
|
assert_match(/<foo>/, actual_content)
|
|
543
540
|
assert_match(/<bar><far href="..\/..">baz<\/far><\/bar>/, actual_content)
|
|
@@ -568,9 +565,9 @@ XML
|
|
|
568
565
|
XML
|
|
569
566
|
|
|
570
567
|
actual_content = filter.setup_and_run(raw_content, {
|
|
571
|
-
:
|
|
572
|
-
:
|
|
573
|
-
:
|
|
568
|
+
type: :xml,
|
|
569
|
+
namespaces: { ex: 'http://example.org' },
|
|
570
|
+
select: ['ex:a/@href']
|
|
574
571
|
})
|
|
575
572
|
|
|
576
573
|
assert_match(/<foo xmlns="http:\/\/example.org">/, actual_content)
|
|
@@ -609,7 +606,7 @@ XML
|
|
|
609
606
|
</html>
|
|
610
607
|
XML
|
|
611
608
|
|
|
612
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
609
|
+
actual_content = filter.setup_and_run(raw_content, type: :xhtml)
|
|
613
610
|
|
|
614
611
|
assert_match(/<link[^>]*href="..\/..\/..\/css"[^>]*\/>/, actual_content)
|
|
615
612
|
assert_match(/<script src="..\/..\/..\/js">/, actual_content)
|
|
@@ -646,7 +643,7 @@ XML
|
|
|
646
643
|
%r{\A\s*<a href="../..">bar</a>\s*<p>\s*<img src="../../../img" />\s*</p>\s*\Z}m
|
|
647
644
|
|
|
648
645
|
# Test
|
|
649
|
-
actual_content = filter.setup_and_run(raw_content.freeze, :
|
|
646
|
+
actual_content = filter.setup_and_run(raw_content.freeze, type: :xhtml)
|
|
650
647
|
assert_match(expected_content, actual_content)
|
|
651
648
|
end
|
|
652
649
|
end
|
|
@@ -676,14 +673,13 @@ XML
|
|
|
676
673
|
|
|
677
674
|
)
|
|
678
675
|
|
|
679
|
-
actual_content = filter.setup_and_run(raw_content.freeze, :
|
|
676
|
+
actual_content = filter.setup_and_run(raw_content.freeze, type: :xhtml)
|
|
680
677
|
|
|
681
678
|
assert_match(/<link (rel="stylesheet" )?href="..\/..\/foo.css" /, actual_content)
|
|
682
679
|
assert_match(/<script src="..\/..\/js\/lib\/html5shiv.js"><\/script>/, actual_content)
|
|
683
680
|
end
|
|
684
681
|
end
|
|
685
682
|
|
|
686
|
-
|
|
687
683
|
def test_filter_fragment_html_with_comments
|
|
688
684
|
if_have 'nokogiri' do
|
|
689
685
|
# Create filter with mock item
|
|
@@ -709,7 +705,7 @@ XML
|
|
|
709
705
|
)
|
|
710
706
|
|
|
711
707
|
# Test
|
|
712
|
-
actual_content = filter.setup_and_run(raw_content.freeze, :
|
|
708
|
+
actual_content = filter.setup_and_run(raw_content.freeze, type: :html)
|
|
713
709
|
assert actual_content.include? %(<script src="../../js/lib/html5shiv.js">)
|
|
714
710
|
end
|
|
715
711
|
end
|
|
@@ -734,8 +730,7 @@ XML
|
|
|
734
730
|
expected_content = %(<!DOCTYPE html>)
|
|
735
731
|
|
|
736
732
|
# Test
|
|
737
|
-
actual_content = filter.setup_and_run(raw_content, :
|
|
733
|
+
actual_content = filter.setup_and_run(raw_content, type: :html)
|
|
738
734
|
assert_equal(expected_content, actual_content)
|
|
739
735
|
end
|
|
740
|
-
|
|
741
736
|
end
|