nanoc 3.7.4 → 3.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +19 -18
  3. data/LICENSE +1 -1
  4. data/NEWS.md +14 -0
  5. data/Rakefile +1 -1
  6. data/doc/yardoc_handlers/identifier.rb +1 -5
  7. data/lib/nanoc.rb +1 -3
  8. data/lib/nanoc/base.rb +1 -4
  9. data/lib/nanoc/base/checksummer.rb +10 -12
  10. data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
  11. data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
  12. data/lib/nanoc/base/compilation/compiler.rb +27 -31
  13. data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
  14. data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
  15. data/lib/nanoc/base/compilation/filter.rb +1 -7
  16. data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
  17. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
  18. data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
  19. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
  20. data/lib/nanoc/base/compilation/rule.rb +1 -5
  21. data/lib/nanoc/base/compilation/rule_context.rb +7 -11
  22. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
  23. data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
  24. data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
  25. data/lib/nanoc/base/context.rb +0 -3
  26. data/lib/nanoc/base/core_ext.rb +0 -1
  27. data/lib/nanoc/base/core_ext/array.rb +0 -2
  28. data/lib/nanoc/base/core_ext/hash.rb +0 -2
  29. data/lib/nanoc/base/core_ext/pathname.rb +0 -2
  30. data/lib/nanoc/base/core_ext/string.rb +0 -2
  31. data/lib/nanoc/base/directed_graph.rb +0 -4
  32. data/lib/nanoc/base/errors.rb +1 -39
  33. data/lib/nanoc/base/memoization.rb +0 -4
  34. data/lib/nanoc/base/notification_center.rb +1 -7
  35. data/lib/nanoc/base/plugin_registry.rb +4 -10
  36. data/lib/nanoc/base/result_data/item_rep.rb +8 -16
  37. data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
  38. data/lib/nanoc/base/source_data/configuration.rb +0 -4
  39. data/lib/nanoc/base/source_data/data_source.rb +2 -5
  40. data/lib/nanoc/base/source_data/item.rb +3 -7
  41. data/lib/nanoc/base/source_data/item_array.rb +1 -5
  42. data/lib/nanoc/base/source_data/layout.rb +2 -6
  43. data/lib/nanoc/base/source_data/site.rb +20 -23
  44. data/lib/nanoc/base/store.rb +1 -5
  45. data/lib/nanoc/base/temp_filename_factory.rb +0 -4
  46. data/lib/nanoc/cli.rb +3 -5
  47. data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
  48. data/lib/nanoc/cli/cleaning_stream.rb +2 -6
  49. data/lib/nanoc/cli/command_runner.rb +1 -5
  50. data/lib/nanoc/cli/commands/autocompile.rb +2 -6
  51. data/lib/nanoc/cli/commands/check.rb +0 -4
  52. data/lib/nanoc/cli/commands/compile.rb +12 -27
  53. data/lib/nanoc/cli/commands/create-item.rb +1 -5
  54. data/lib/nanoc/cli/commands/create-layout.rb +0 -4
  55. data/lib/nanoc/cli/commands/create-site.rb +2 -8
  56. data/lib/nanoc/cli/commands/deploy.rb +3 -7
  57. data/lib/nanoc/cli/commands/prune.rb +2 -6
  58. data/lib/nanoc/cli/commands/shell.rb +4 -8
  59. data/lib/nanoc/cli/commands/show-data.rb +3 -7
  60. data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
  61. data/lib/nanoc/cli/commands/show-rules.rb +11 -15
  62. data/lib/nanoc/cli/commands/sync.rb +0 -4
  63. data/lib/nanoc/cli/commands/update.rb +1 -7
  64. data/lib/nanoc/cli/commands/validate-css.rb +0 -4
  65. data/lib/nanoc/cli/commands/validate-html.rb +0 -4
  66. data/lib/nanoc/cli/commands/validate-links.rb +0 -4
  67. data/lib/nanoc/cli/commands/view.rb +3 -7
  68. data/lib/nanoc/cli/commands/watch.rb +4 -10
  69. data/lib/nanoc/cli/error_handler.rb +9 -13
  70. data/lib/nanoc/cli/logger.rb +8 -12
  71. data/lib/nanoc/cli/stream_cleaners.rb +0 -4
  72. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
  73. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
  74. data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
  75. data/lib/nanoc/data_sources.rb +2 -4
  76. data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
  77. data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
  78. data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
  79. data/lib/nanoc/data_sources/filesystem.rb +10 -13
  80. data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
  81. data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
  82. data/lib/nanoc/data_sources/static.rb +4 -8
  83. data/lib/nanoc/extra.rb +2 -4
  84. data/lib/nanoc/extra/auto_compiler.rb +2 -6
  85. data/lib/nanoc/extra/checking.rb +0 -4
  86. data/lib/nanoc/extra/checking/check.rb +0 -4
  87. data/lib/nanoc/extra/checking/checks.rb +0 -2
  88. data/lib/nanoc/extra/checking/checks/css.rb +6 -6
  89. data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
  90. data/lib/nanoc/extra/checking/checks/html.rb +6 -6
  91. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
  92. data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
  93. data/lib/nanoc/extra/checking/dsl.rb +0 -4
  94. data/lib/nanoc/extra/checking/issue.rb +0 -4
  95. data/lib/nanoc/extra/checking/runner.rb +4 -7
  96. data/lib/nanoc/extra/chick.rb +7 -17
  97. data/lib/nanoc/extra/core_ext.rb +0 -1
  98. data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
  99. data/lib/nanoc/extra/core_ext/time.rb +0 -2
  100. data/lib/nanoc/extra/deployer.rb +0 -4
  101. data/lib/nanoc/extra/deployers.rb +0 -4
  102. data/lib/nanoc/extra/deployers/fog.rb +7 -11
  103. data/lib/nanoc/extra/deployers/rsync.rb +1 -5
  104. data/lib/nanoc/extra/file_proxy.rb +1 -5
  105. data/lib/nanoc/extra/filesystem_tools.rb +37 -12
  106. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
  107. data/lib/nanoc/extra/link_collector.rb +3 -7
  108. data/lib/nanoc/extra/piper.rb +0 -6
  109. data/lib/nanoc/extra/pruner.rb +1 -7
  110. data/lib/nanoc/extra/validators.rb +0 -4
  111. data/lib/nanoc/extra/validators/links.rb +0 -4
  112. data/lib/nanoc/extra/validators/w3c.rb +0 -4
  113. data/lib/nanoc/extra/vcs.rb +3 -7
  114. data/lib/nanoc/extra/vcses.rb +0 -2
  115. data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
  116. data/lib/nanoc/extra/vcses/dummy.rb +0 -4
  117. data/lib/nanoc/extra/vcses/git.rb +0 -4
  118. data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
  119. data/lib/nanoc/extra/vcses/subversion.rb +0 -4
  120. data/lib/nanoc/filters.rb +0 -2
  121. data/lib/nanoc/filters/asciidoc.rb +1 -5
  122. data/lib/nanoc/filters/bluecloth.rb +0 -2
  123. data/lib/nanoc/filters/coderay.rb +0 -2
  124. data/lib/nanoc/filters/coffeescript.rb +0 -4
  125. data/lib/nanoc/filters/colorize_syntax.rb +17 -15
  126. data/lib/nanoc/filters/erb.rb +1 -3
  127. data/lib/nanoc/filters/erubis.rb +2 -4
  128. data/lib/nanoc/filters/haml.rb +2 -4
  129. data/lib/nanoc/filters/handlebars.rb +0 -4
  130. data/lib/nanoc/filters/kramdown.rb +7 -4
  131. data/lib/nanoc/filters/less.rb +1 -3
  132. data/lib/nanoc/filters/markaby.rb +0 -2
  133. data/lib/nanoc/filters/maruku.rb +0 -2
  134. data/lib/nanoc/filters/mustache.rb +1 -5
  135. data/lib/nanoc/filters/pandoc.rb +0 -2
  136. data/lib/nanoc/filters/rainpress.rb +0 -2
  137. data/lib/nanoc/filters/rdiscount.rb +0 -2
  138. data/lib/nanoc/filters/rdoc.rb +0 -2
  139. data/lib/nanoc/filters/redcarpet.rb +0 -4
  140. data/lib/nanoc/filters/redcloth.rb +0 -2
  141. data/lib/nanoc/filters/relativize_paths.rb +2 -4
  142. data/lib/nanoc/filters/rubypants.rb +0 -2
  143. data/lib/nanoc/filters/sass.rb +2 -4
  144. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
  145. data/lib/nanoc/filters/slim.rb +2 -6
  146. data/lib/nanoc/filters/typogruby.rb +0 -4
  147. data/lib/nanoc/filters/uglify_js.rb +0 -2
  148. data/lib/nanoc/filters/xsl.rb +1 -5
  149. data/lib/nanoc/filters/yui_compressor.rb +0 -4
  150. data/lib/nanoc/helpers.rb +0 -2
  151. data/lib/nanoc/helpers/blogging.rb +12 -20
  152. data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
  153. data/lib/nanoc/helpers/capturing.rb +2 -10
  154. data/lib/nanoc/helpers/filtering.rb +0 -4
  155. data/lib/nanoc/helpers/html_escape.rb +3 -7
  156. data/lib/nanoc/helpers/link_to.rb +0 -4
  157. data/lib/nanoc/helpers/rendering.rb +8 -12
  158. data/lib/nanoc/helpers/tagging.rb +0 -4
  159. data/lib/nanoc/helpers/text.rb +1 -5
  160. data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
  161. data/lib/nanoc/tasks/clean.rb +1 -7
  162. data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
  163. data/lib/nanoc/tasks/validate.rake +0 -4
  164. data/lib/nanoc/version.rb +1 -3
  165. data/nanoc.gemspec +12 -9
  166. data/tasks/rubocop.rake +1 -1
  167. data/tasks/test.rake +6 -7
  168. data/test/base/checksummer_spec.rb +28 -44
  169. data/test/base/core_ext/array_spec.rb +1 -9
  170. data/test/base/core_ext/hash_spec.rb +7 -19
  171. data/test/base/core_ext/pathname_spec.rb +2 -4
  172. data/test/base/core_ext/string_spec.rb +0 -4
  173. data/test/base/temp_filename_factory_spec.rb +0 -8
  174. data/test/base/test_checksum_store.rb +0 -2
  175. data/test/base/test_code_snippet.rb +0 -2
  176. data/test/base/test_compiler.rb +15 -17
  177. data/test/base/test_compiler_dsl.rb +7 -9
  178. data/test/base/test_context.rb +2 -4
  179. data/test/base/test_data_source.rb +0 -2
  180. data/test/base/test_dependency_tracker.rb +0 -2
  181. data/test/base/test_directed_graph.rb +2 -4
  182. data/test/base/test_filter.rb +5 -7
  183. data/test/base/test_item.rb +17 -13
  184. data/test/base/test_item_array.rb +2 -4
  185. data/test/base/test_item_rep.rb +79 -73
  186. data/test/base/test_layout.rb +3 -5
  187. data/test/base/test_memoization.rb +13 -21
  188. data/test/base/test_notification_center.rb +0 -2
  189. data/test/base/test_outdatedness_checker.rb +34 -36
  190. data/test/base/test_plugin.rb +0 -2
  191. data/test/base/test_rule.rb +3 -5
  192. data/test/base/test_rule_context.rb +4 -6
  193. data/test/base/test_site.rb +9 -17
  194. data/test/base/test_store.rb +2 -6
  195. data/test/cli/commands/test_check.rb +1 -3
  196. data/test/cli/commands/test_compile.rb +24 -15
  197. data/test/cli/commands/test_create_item.rb +1 -3
  198. data/test/cli/commands/test_create_layout.rb +0 -2
  199. data/test/cli/commands/test_create_site.rb +0 -3
  200. data/test/cli/commands/test_deploy.rb +9 -11
  201. data/test/cli/commands/test_help.rb +0 -2
  202. data/test/cli/commands/test_info.rb +0 -2
  203. data/test/cli/commands/test_prune.rb +6 -8
  204. data/test/cli/commands/test_sync.rb +0 -2
  205. data/test/cli/commands/test_update.rb +0 -2
  206. data/test/cli/commands/test_watch.rb +4 -6
  207. data/test/cli/test_cleaning_stream.rb +4 -6
  208. data/test/cli/test_cli.rb +9 -5
  209. data/test/cli/test_error_handler.rb +9 -7
  210. data/test/cli/test_logger.rb +0 -2
  211. data/test/data_sources/test_filesystem.rb +8 -10
  212. data/test/data_sources/test_filesystem_unified.rb +35 -34
  213. data/test/data_sources/test_filesystem_verbose.rb +31 -33
  214. data/test/data_sources/test_static.rb +20 -21
  215. data/test/extra/checking/checks/test_css.rb +23 -2
  216. data/test/extra/checking/checks/test_external_links.rb +2 -4
  217. data/test/extra/checking/checks/test_html.rb +4 -3
  218. data/test/extra/checking/checks/test_internal_links.rb +1 -3
  219. data/test/extra/checking/checks/test_stale.rb +4 -6
  220. data/test/extra/checking/test_check.rb +0 -2
  221. data/test/extra/checking/test_dsl.rb +1 -3
  222. data/test/extra/checking/test_runner.rb +0 -2
  223. data/test/extra/core_ext/test_pathname.rb +0 -3
  224. data/test/extra/core_ext/test_time.rb +0 -2
  225. data/test/extra/deployers/test_fog.rb +13 -15
  226. data/test/extra/deployers/test_rsync.rb +4 -6
  227. data/test/extra/test_auto_compiler.rb +47 -25
  228. data/test/extra/test_file_proxy.rb +1 -3
  229. data/test/extra/test_filesystem_tools.rb +47 -7
  230. data/test/extra/test_link_collector.rb +0 -2
  231. data/test/extra/test_piper.rb +3 -5
  232. data/test/extra/test_vcs.rb +0 -2
  233. data/test/extra/validators/test_links.rb +0 -1
  234. data/test/extra/validators/test_w3c.rb +2 -4
  235. data/test/filters/test_asciidoc.rb +0 -2
  236. data/test/filters/test_bluecloth.rb +0 -2
  237. data/test/filters/test_coderay.rb +2 -4
  238. data/test/filters/test_coffeescript.rb +0 -2
  239. data/test/filters/test_colorize_syntax.rb +16 -18
  240. data/test/filters/test_erb.rb +12 -14
  241. data/test/filters/test_erubis.rb +4 -6
  242. data/test/filters/test_haml.rb +7 -9
  243. data/test/filters/test_handlebars.rb +10 -12
  244. data/test/filters/test_kramdown.rb +13 -1
  245. data/test/filters/test_less.rb +9 -11
  246. data/test/filters/test_markaby.rb +0 -2
  247. data/test/filters/test_maruku.rb +0 -2
  248. data/test/filters/test_mustache.rb +4 -6
  249. data/test/filters/test_pandoc.rb +1 -3
  250. data/test/filters/test_rainpress.rb +1 -3
  251. data/test/filters/test_rdiscount.rb +1 -3
  252. data/test/filters/test_rdoc.rb +0 -2
  253. data/test/filters/test_redcarpet.rb +6 -8
  254. data/test/filters/test_redcloth.rb +1 -3
  255. data/test/filters/test_relativize_paths.rb +29 -34
  256. data/test/filters/test_rubypants.rb +0 -2
  257. data/test/filters/test_sass.rb +8 -10
  258. data/test/filters/test_slim.rb +2 -4
  259. data/test/filters/test_typogruby.rb +0 -3
  260. data/test/filters/test_uglify_js.rb +2 -4
  261. data/test/filters/test_xsl.rb +16 -18
  262. data/test/filters/test_yui_compressor.rb +3 -5
  263. data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
  264. data/test/gem_loader.rb +1 -1
  265. data/test/helper.rb +11 -15
  266. data/test/helpers/test_blogging.rb +61 -63
  267. data/test/helpers/test_breadcrumbs.rb +0 -2
  268. data/test/helpers/test_capturing.rb +4 -6
  269. data/test/helpers/test_filtering.rb +2 -4
  270. data/test/helpers/test_html_escape.rb +0 -2
  271. data/test/helpers/test_link_to.rb +5 -6
  272. data/test/helpers/test_rendering.rb +2 -4
  273. data/test/helpers/test_tagging.rb +9 -11
  274. data/test/helpers/test_text.rb +6 -8
  275. data/test/helpers/test_xml_sitemap.rb +11 -13
  276. data/test/tasks/test_clean.rb +0 -2
  277. data/test/test_gem.rb +1 -3
  278. metadata +15 -14
  279. data/Gemfile.lock +0 -252
  280. data/lib/nanoc/base/core_ext/date.rb +0 -29
  281. data/lib/nanoc/base/ordered_hash.rb +0 -228
  282. data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
  283. data/test/base/core_ext/date_spec.rb +0 -15
  284. 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
- { :title => 'Max Payne', :protagonist => 'Max Payne', :location => 'here' },
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
- { :name => 'Max Payne' },
13
+ { name: 'Max Payne' },
15
14
  '/default/')
16
- config = { :animals => 'cats and dogs' }
15
+ config = { animals: 'cats and dogs' }
17
16
 
18
17
  # Create filter
19
18
  assigns = {
20
- :item => item,
21
- :layout => layout,
22
- :config => config,
23
- :content => 'No Payne No Gayne'
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
- { :title => 'Max Payne', :protagonist => 'Max Payne', :location => 'here' },
41
+ { title: 'Max Payne', protagonist: 'Max Payne', location: 'here' },
43
42
  '/games/max-payne/')
44
43
 
45
44
  # Create filter
46
45
  assigns = {
47
- :item => item,
48
- :content => 'No Payne No Gayne'
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
@@ -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', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
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(:item => @item, :items => [@item])
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', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
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(:item => @item, :items => [@item])
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', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
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(:item => @item, :items => [@item])
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', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
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(:item => @item, :items => [@item])
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; }', :compress => true)
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
@@ -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
- { :title => 'Max Payne', :protagonist => 'Max Payne' },
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({ :item => item })
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
- { :title => 'Max Payne', :protagonist => 'Max Payne' },
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
- { :content => 'No Payne No Gayne', :item => item })
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
@@ -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, {:f => :markdown, :to => :html}, 'no-wrap', :toc]
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; }', :colors => false)
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 &lsquo;marks&rsquo; sure make this look sarcastic!/
24
- output_actual = filter.setup_and_run(input, :extensions => [:smart])
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
@@ -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, :options => { :strikethrough => true })
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 &lsquo;marks&rsquo; sure make this look sarcastic!/
35
- output_actual = filter.setup_and_run(input, :options => [:smart])
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 = "![Alt](/path/to/img 'Title')"
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, :renderer_options => { :xhtml => true })
62
+ output_actual = filter.setup_and_run(input, renderer_options: { xhtml: true })
64
63
  else
65
- output_actual = filter.setup_and_run(input, :options => [:xhtml])
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, :renderer => Redcarpet::Render::HTML_TOC)
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, :with_toc => true)
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.', :no_span_caps => true)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :html)
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, :type => :css)
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, :type => :css)
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, :type => :css)
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, :type => :css)
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, :type => :css)
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, :type => :css)
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, :type => :xml, :select => ['*/@boo'])
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, :type => :xml, :select => ['far/@href'])
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
- :type => :xml,
572
- :namespaces => {:ex => 'http://example.org'},
573
- :select => ['ex:a/@href']
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, :type => :xhtml)
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, :type => :xhtml)
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, :type => :xhtml)
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, :type => :html)
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 = %(&lt;!DOCTYPE html&gt;)
735
731
 
736
732
  # Test
737
- actual_content = filter.setup_and_run(raw_content, :type => :html)
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