nanoc 3.8.0 → 4.0.0a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +322 -0
  4. data/NEWS.md +6 -0
  5. data/bin/nanoc +0 -18
  6. data/lib/nanoc.rb +5 -3
  7. data/lib/nanoc/base.rb +24 -6
  8. data/lib/nanoc/base/checksummer.rb +6 -4
  9. data/lib/nanoc/base/compilation/checksum_store.rb +4 -4
  10. data/lib/nanoc/base/compilation/compiled_content_cache.rb +5 -5
  11. data/lib/nanoc/base/compilation/compiler.rb +60 -65
  12. data/lib/nanoc/base/compilation/compiler_dsl.rb +11 -9
  13. data/lib/nanoc/base/compilation/dependency_tracker.rb +24 -38
  14. data/lib/nanoc/base/compilation/filter.rb +22 -7
  15. data/lib/nanoc/base/compilation/item_rep_proxy.rb +14 -12
  16. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -8
  17. data/lib/nanoc/base/compilation/outdatedness_checker.rb +32 -32
  18. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +3 -1
  19. data/lib/nanoc/base/compilation/rule.rb +9 -7
  20. data/lib/nanoc/base/compilation/rule_context.rb +15 -15
  21. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
  22. data/lib/nanoc/base/compilation/rule_memory_store.rb +7 -7
  23. data/lib/nanoc/base/compilation/rules_collection.rb +28 -30
  24. data/lib/nanoc/base/context.rb +2 -2
  25. data/lib/nanoc/base/core_ext/array.rb +17 -25
  26. data/lib/nanoc/base/core_ext/hash.rb +17 -25
  27. data/lib/nanoc/base/core_ext/pathname.rb +4 -2
  28. data/lib/nanoc/base/core_ext/string.rb +5 -3
  29. data/lib/nanoc/base/directed_graph.rb +4 -9
  30. data/lib/nanoc/base/error.rb +7 -0
  31. data/lib/nanoc/base/errors.rb +16 -23
  32. data/lib/nanoc/base/memoization.rb +4 -2
  33. data/lib/nanoc/base/notification_center.rb +3 -1
  34. data/lib/nanoc/base/plugin_registry.rb +14 -21
  35. data/lib/nanoc/base/result_data/item_rep.rb +43 -88
  36. data/lib/nanoc/base/source_data/code_snippet.rb +6 -4
  37. data/lib/nanoc/base/source_data/configuration.rb +3 -1
  38. data/lib/nanoc/base/source_data/data_source.rb +12 -94
  39. data/lib/nanoc/base/source_data/identifier.rb +50 -0
  40. data/lib/nanoc/base/source_data/item.rb +24 -67
  41. data/lib/nanoc/base/source_data/item_array.rb +6 -4
  42. data/lib/nanoc/base/source_data/layout.rb +17 -28
  43. data/lib/nanoc/base/source_data/site.rb +33 -44
  44. data/lib/nanoc/base/store.rb +3 -5
  45. data/lib/nanoc/base/temp_filename_factory.rb +3 -2
  46. data/lib/nanoc/base/views/config.rb +19 -0
  47. data/lib/nanoc/base/views/item.rb +77 -0
  48. data/lib/nanoc/base/views/item_collection.rb +43 -0
  49. data/lib/nanoc/base/views/item_rep.rb +125 -0
  50. data/lib/nanoc/base/views/layout.rb +42 -0
  51. data/lib/nanoc/base/views/layout_collection.rb +26 -0
  52. data/lib/nanoc/base/views/mutable_config.rb +9 -0
  53. data/lib/nanoc/base/views/mutable_item.rb +9 -0
  54. data/lib/nanoc/base/views/mutable_item_collection.rb +18 -0
  55. data/lib/nanoc/base/views/mutable_layout.rb +9 -0
  56. data/lib/nanoc/base/views/mutable_layout_collection.rb +18 -0
  57. data/lib/nanoc/base/views/site.rb +35 -0
  58. data/lib/nanoc/cli.rb +3 -6
  59. data/lib/nanoc/cli/ansi_string_colorizer.rb +2 -0
  60. data/lib/nanoc/cli/cleaning_stream.rb +2 -0
  61. data/lib/nanoc/cli/command_runner.rb +8 -42
  62. data/lib/nanoc/cli/commands/check.rb +2 -2
  63. data/lib/nanoc/cli/commands/compile.rb +19 -34
  64. data/lib/nanoc/cli/commands/create-site.rb +46 -83
  65. data/lib/nanoc/cli/commands/deploy.rb +4 -4
  66. data/lib/nanoc/cli/commands/shell.rb +1 -1
  67. data/lib/nanoc/cli/commands/show-plugins.rb +4 -6
  68. data/lib/nanoc/cli/error_handler.rb +4 -14
  69. data/lib/nanoc/cli/logger.rb +2 -0
  70. data/lib/nanoc/cli/stream_cleaners.rb +1 -0
  71. data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -0
  72. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -0
  73. data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -0
  74. data/lib/nanoc/data_sources.rb +1 -17
  75. data/lib/nanoc/data_sources/filesystem.rb +6 -37
  76. data/lib/nanoc/data_sources/filesystem_unified.rb +5 -3
  77. data/lib/nanoc/data_sources/filesystem_verbose.rb +5 -3
  78. data/lib/nanoc/data_sources/static.rb +4 -2
  79. data/lib/nanoc/extra.rb +1 -13
  80. data/lib/nanoc/extra/checking.rb +1 -0
  81. data/lib/nanoc/extra/checking/check.rb +4 -2
  82. data/lib/nanoc/extra/checking/checks.rb +1 -0
  83. data/lib/nanoc/extra/checking/checks/css.rb +1 -0
  84. data/lib/nanoc/extra/checking/checks/external_links.rb +2 -0
  85. data/lib/nanoc/extra/checking/checks/html.rb +1 -0
  86. data/lib/nanoc/extra/checking/checks/internal_links.rb +2 -0
  87. data/lib/nanoc/extra/checking/checks/mixed_content.rb +2 -0
  88. data/lib/nanoc/extra/checking/checks/stale.rb +1 -0
  89. data/lib/nanoc/extra/checking/dsl.rb +1 -0
  90. data/lib/nanoc/extra/checking/issue.rb +1 -0
  91. data/lib/nanoc/extra/checking/runner.rb +3 -3
  92. data/lib/nanoc/extra/core_ext/pathname.rb +5 -3
  93. data/lib/nanoc/extra/core_ext/time.rb +4 -2
  94. data/lib/nanoc/extra/deployer.rb +3 -1
  95. data/lib/nanoc/extra/deployers.rb +1 -0
  96. data/lib/nanoc/extra/deployers/fog.rb +2 -0
  97. data/lib/nanoc/extra/deployers/rsync.rb +2 -0
  98. data/lib/nanoc/extra/filesystem_tools.rb +3 -7
  99. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -0
  100. data/lib/nanoc/extra/link_collector.rb +1 -0
  101. data/lib/nanoc/extra/piper.rb +2 -1
  102. data/lib/nanoc/extra/pruner.rb +5 -3
  103. data/lib/nanoc/filters.rb +1 -2
  104. data/lib/nanoc/filters/asciidoc.rb +2 -0
  105. data/lib/nanoc/filters/bluecloth.rb +1 -0
  106. data/lib/nanoc/filters/coffeescript.rb +2 -0
  107. data/lib/nanoc/filters/colorize_syntax.rb +1 -12
  108. data/lib/nanoc/filters/erb.rb +2 -1
  109. data/lib/nanoc/filters/erubis.rb +2 -1
  110. data/lib/nanoc/filters/haml.rb +2 -1
  111. data/lib/nanoc/filters/handlebars.rb +2 -0
  112. data/lib/nanoc/filters/kramdown.rb +1 -0
  113. data/lib/nanoc/filters/less.rb +1 -0
  114. data/lib/nanoc/filters/markaby.rb +1 -0
  115. data/lib/nanoc/filters/maruku.rb +1 -0
  116. data/lib/nanoc/filters/mustache.rb +2 -0
  117. data/lib/nanoc/filters/pandoc.rb +1 -0
  118. data/lib/nanoc/filters/rainpress.rb +1 -0
  119. data/lib/nanoc/filters/rdiscount.rb +1 -0
  120. data/lib/nanoc/filters/rdoc.rb +1 -0
  121. data/lib/nanoc/filters/redcarpet.rb +2 -0
  122. data/lib/nanoc/filters/redcloth.rb +1 -0
  123. data/lib/nanoc/filters/relativize_paths.rb +1 -0
  124. data/lib/nanoc/filters/rubypants.rb +1 -0
  125. data/lib/nanoc/filters/sass.rb +1 -0
  126. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +2 -0
  127. data/lib/nanoc/filters/slim.rb +3 -1
  128. data/lib/nanoc/filters/typogruby.rb +2 -0
  129. data/lib/nanoc/filters/uglify_js.rb +1 -0
  130. data/lib/nanoc/filters/xsl.rb +2 -0
  131. data/lib/nanoc/filters/yui_compressor.rb +2 -0
  132. data/lib/nanoc/helpers/blogging.rb +30 -30
  133. data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
  134. data/lib/nanoc/helpers/capturing.rb +6 -17
  135. data/lib/nanoc/helpers/filtering.rb +3 -3
  136. data/lib/nanoc/helpers/link_to.rb +3 -3
  137. data/lib/nanoc/helpers/rendering.rb +11 -11
  138. data/lib/nanoc/helpers/xml_sitemap.rb +3 -3
  139. data/lib/nanoc/tasks.rb +1 -0
  140. data/lib/nanoc/tasks/clean.rake +1 -1
  141. data/lib/nanoc/version.rb +1 -1
  142. data/tasks/doc.rake +2 -1
  143. data/tasks/test.rake +7 -1
  144. data/test/base/checksummer_spec.rb +15 -15
  145. data/test/base/core_ext/array_spec.rb +10 -10
  146. data/test/base/core_ext/hash_spec.rb +16 -16
  147. data/test/base/core_ext/pathname_spec.rb +2 -2
  148. data/test/base/core_ext/string_spec.rb +9 -9
  149. data/test/base/temp_filename_factory_spec.rb +3 -7
  150. data/test/base/test_checksum_store.rb +5 -5
  151. data/test/base/test_code_snippet.rb +3 -3
  152. data/test/base/test_compiler.rb +29 -29
  153. data/test/base/test_compiler_dsl.rb +23 -23
  154. data/test/base/test_context.rb +4 -4
  155. data/test/base/test_data_source.rb +17 -7
  156. data/test/base/test_dependency_tracker.rb +29 -29
  157. data/test/base/test_directed_graph.rb +27 -27
  158. data/test/base/test_item.rb +23 -21
  159. data/test/base/test_item_array.rb +18 -18
  160. data/test/base/test_item_rep.rb +76 -76
  161. data/test/base/test_item_rep_recorder_proxy.rb +4 -4
  162. data/test/base/test_layout.rb +8 -16
  163. data/test/base/test_memoization.rb +4 -4
  164. data/test/base/test_notification_center.rb +6 -6
  165. data/test/base/test_outdatedness_checker.rb +18 -18
  166. data/test/base/test_plugin.rb +1 -1
  167. data/test/base/test_rule.rb +2 -2
  168. data/test/base/test_rule_context.rb +5 -5
  169. data/test/base/test_site.rb +62 -38
  170. data/test/base/test_store.rb +2 -2
  171. data/test/cli/commands/test_check.rb +1 -1
  172. data/test/cli/commands/test_compile.rb +24 -18
  173. data/test/cli/commands/test_create_site.rb +5 -7
  174. data/test/cli/commands/test_deploy.rb +1 -1
  175. data/test/data_sources/test_filesystem.rb +22 -67
  176. data/test/data_sources/test_filesystem_unified.rb +10 -23
  177. data/test/data_sources/test_filesystem_verbose.rb +8 -53
  178. data/test/data_sources/test_static.rb +9 -9
  179. data/test/extra/checking/checks/test_stale.rb +1 -1
  180. data/test/extra/core_ext/test_pathname.rb +3 -3
  181. data/test/extra/core_ext/test_time.rb +4 -4
  182. data/test/extra/test_filesystem_tools.rb +1 -1
  183. data/test/filters/test_handlebars.rb +3 -3
  184. data/test/filters/test_less.rb +6 -6
  185. data/test/filters/test_mustache.rb +2 -2
  186. data/test/filters/test_relativize_paths.rb +81 -81
  187. data/test/filters/test_sass.rb +7 -7
  188. data/test/filters/test_xsl.rb +6 -6
  189. data/test/helper.rb +1 -1
  190. data/test/helpers/test_blogging.rb +78 -99
  191. data/test/helpers/test_breadcrumbs.rb +12 -12
  192. data/test/helpers/test_capturing.rb +10 -11
  193. data/test/helpers/test_filtering.rb +6 -6
  194. data/test/helpers/test_rendering.rb +3 -3
  195. data/test/helpers/test_tagging.rb +7 -7
  196. data/test/helpers/test_xml_sitemap.rb +34 -33
  197. metadata +19 -43
  198. data/lib/nanoc/cli/commands/autocompile.rb +0 -69
  199. data/lib/nanoc/cli/commands/create-item.rb +0 -55
  200. data/lib/nanoc/cli/commands/create-layout.rb +0 -68
  201. data/lib/nanoc/cli/commands/sync.rb +0 -32
  202. data/lib/nanoc/cli/commands/update.rb +0 -63
  203. data/lib/nanoc/cli/commands/validate-css.rb +0 -20
  204. data/lib/nanoc/cli/commands/validate-html.rb +0 -20
  205. data/lib/nanoc/cli/commands/validate-links.rb +0 -27
  206. data/lib/nanoc/cli/commands/watch.rb +0 -176
  207. data/lib/nanoc/data_sources/deprecated/delicious.rb +0 -38
  208. data/lib/nanoc/data_sources/deprecated/last_fm.rb +0 -85
  209. data/lib/nanoc/data_sources/deprecated/twitter.rb +0 -34
  210. data/lib/nanoc/extra/auto_compiler.rb +0 -99
  211. data/lib/nanoc/extra/chick.rb +0 -117
  212. data/lib/nanoc/extra/file_proxy.rb +0 -36
  213. data/lib/nanoc/extra/validators.rb +0 -8
  214. data/lib/nanoc/extra/validators/links.rb +0 -18
  215. data/lib/nanoc/extra/validators/w3c.rb +0 -23
  216. data/lib/nanoc/extra/vcs.rb +0 -62
  217. data/lib/nanoc/extra/vcses.rb +0 -15
  218. data/lib/nanoc/extra/vcses/bazaar.rb +0 -21
  219. data/lib/nanoc/extra/vcses/dummy.rb +0 -20
  220. data/lib/nanoc/extra/vcses/git.rb +0 -21
  221. data/lib/nanoc/extra/vcses/mercurial.rb +0 -21
  222. data/lib/nanoc/extra/vcses/subversion.rb +0 -21
  223. data/lib/nanoc/filters/coderay.rb +0 -19
  224. data/lib/nanoc3.rb +0 -3
  225. data/lib/nanoc3/cli.rb +0 -3
  226. data/lib/nanoc3/tasks.rb +0 -3
  227. data/test/cli/commands/test_create_item.rb +0 -10
  228. data/test/cli/commands/test_create_layout.rb +0 -24
  229. data/test/cli/commands/test_sync.rb +0 -27
  230. data/test/cli/commands/test_update.rb +0 -6
  231. data/test/cli/commands/test_watch.rb +0 -74
  232. data/test/extra/test_auto_compiler.rb +0 -437
  233. data/test/extra/test_vcs.rb +0 -18
  234. data/test/extra/validators/test_links.rb +0 -4
  235. data/test/extra/validators/test_w3c.rb +0 -37
  236. data/test/filters/test_coderay.rb +0 -40
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Kramdown < Nanoc::Filter
5
6
  requires 'kramdown'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Less < Nanoc::Filter
5
6
  requires 'less'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Markaby < Nanoc::Filter
5
6
  requires 'markaby'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Maruku < Nanoc::Filter
5
6
  requires 'maruku'
6
7
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @since 3.2.0
5
+ #
6
+ # @api private
5
7
  class Mustache < Nanoc::Filter
6
8
  requires 'mustache'
7
9
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Pandoc < Nanoc::Filter
5
6
  requires 'pandoc-ruby'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Rainpress < Nanoc::Filter
5
6
  requires 'rainpress'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class RDiscount < Nanoc::Filter
5
6
  requires 'rdiscount'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class RDoc < Nanoc::Filter
5
6
  requires 'rdoc'
6
7
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @since 3.2.0
5
+ #
6
+ # @api private
5
7
  class Redcarpet < Nanoc::Filter
6
8
  requires 'redcarpet'
7
9
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class RedCloth < Nanoc::Filter
5
6
  requires 'redcloth'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class RelativizePaths < Nanoc::Filter
5
6
  require 'nanoc/helpers/link_to'
6
7
  include Nanoc::Helpers::LinkTo
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class RubyPants < Nanoc::Filter
5
6
  requires 'rubypants'
6
7
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class Sass < Nanoc::Filter
5
6
  requires 'sass', 'nanoc/filters/sass/sass_filesystem_importer'
6
7
 
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # @api private
3
4
  class ::Sass::Importers::Filesystem
4
5
  alias_method :_orig_find, :_find
5
6
 
@@ -12,6 +13,7 @@ class ::Sass::Importers::Filesystem
12
13
  filter = options[:nanoc_current_filter]
13
14
  if filter
14
15
  item = filter.imported_filename_to_item(full_filename)
16
+ item = item.unwrap if item.respond_to?(:unwrap)
15
17
  filter.depend_on([item]) unless item.nil?
16
18
  end
17
19
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @since 3.2.0
5
+ #
6
+ # @api private
5
7
  class Slim < Nanoc::Filter
6
8
  requires 'slim'
7
9
 
@@ -18,7 +20,7 @@ module Nanoc::Filters
18
20
  }.merge params
19
21
 
20
22
  # Create context
21
- context = ::Nanoc::Context.new(assigns)
23
+ context = ::Nanoc::Int::Context.new(assigns)
22
24
 
23
25
  ::Slim::Template.new(params) { content }.render(context) { assigns[:content] }
24
26
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @since 3.2.0
5
+ #
6
+ # @api private
5
7
  class Typogruby < Nanoc::Filter
6
8
  requires 'typogruby'
7
9
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Nanoc::Filters
4
+ # @api private
4
5
  class UglifyJS < Nanoc::Filter
5
6
  requires 'uglifier'
6
7
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @since 3.3.0
5
+ #
6
+ # @api private
5
7
  class XSL < Nanoc::Filter
6
8
  requires 'nokogiri'
7
9
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Nanoc::Filters
4
4
  # @since 3.3.0
5
+ #
6
+ # @api private
5
7
  class YUICompressor < Nanoc::Filter
6
8
  requires 'yuicompressor'
7
9
 
@@ -52,7 +52,7 @@ module Nanoc::Helpers
52
52
  class AtomFeedBuilder
53
53
  include Nanoc::Helpers::Blogging
54
54
 
55
- attr_accessor :site
55
+ attr_accessor :config
56
56
 
57
57
  attr_accessor :limit
58
58
  attr_accessor :relevant_articles
@@ -65,8 +65,8 @@ module Nanoc::Helpers
65
65
  attr_accessor :icon
66
66
  attr_accessor :logo
67
67
 
68
- def initialize(site, item)
69
- @site = site
68
+ def initialize(config, item)
69
+ @config = config
70
70
  @item = item
71
71
  end
72
72
 
@@ -100,43 +100,43 @@ module Nanoc::Helpers
100
100
  end
101
101
 
102
102
  def validate_config
103
- if @site.config[:base_url].nil?
104
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: site configuration has no base_url')
103
+ if @config[:base_url].nil?
104
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: site configuration has no base_url')
105
105
  end
106
106
  end
107
107
 
108
108
  def validate_feed_item
109
109
  if title.nil?
110
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: no title in params, item or site config')
110
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: no title in params, item or site config')
111
111
  end
112
112
  if author_name.nil?
113
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: no author_name in params, item or site config')
113
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: no author_name in params, item or site config')
114
114
  end
115
115
  if author_uri.nil?
116
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: no author_uri in params, item or site config')
116
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: no author_uri in params, item or site config')
117
117
  end
118
118
  end
119
119
 
120
120
  def validate_articles
121
121
  if relevant_articles.empty?
122
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: no articles')
122
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: no articles')
123
123
  end
124
124
  if relevant_articles.any? { |a| a[:created_at].nil? }
125
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: one or more articles lack created_at')
125
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: one or more articles lack created_at')
126
126
  end
127
127
  end
128
128
 
129
129
  def build_for_feed(xml)
130
130
  xml.instruct!
131
131
  xml.feed(xmlns: 'http://www.w3.org/2005/Atom') do
132
- root_url = @site.config[:base_url] + '/'
132
+ root_url = @config[:base_url] + '/'
133
133
 
134
134
  # Add primary attributes
135
135
  xml.id root_url
136
136
  xml.title title
137
137
 
138
138
  # Add date
139
- xml.updated(attribute_to_time(last_article[:created_at]).to_iso8601_time)
139
+ xml.updated(attribute_to_time(last_article[:created_at]).__nanoc_to_iso8601_time)
140
140
 
141
141
  # Add links
142
142
  xml.link(rel: 'alternate', href: root_url)
@@ -170,8 +170,8 @@ module Nanoc::Helpers
170
170
  xml.title a[:title], type: 'html'
171
171
 
172
172
  # Add dates
173
- xml.published attribute_to_time(a[:created_at]).to_iso8601_time
174
- xml.updated attribute_to_time(a[:updated_at] || a[:created_at]).to_iso8601_time
173
+ xml.published attribute_to_time(a[:created_at]).__nanoc_to_iso8601_time
174
+ xml.updated attribute_to_time(a[:updated_at] || a[:created_at]).__nanoc_to_iso8601_time
175
175
 
176
176
  # Add specific author information
177
177
  if a[:author_name] || a[:author_uri]
@@ -308,7 +308,7 @@ module Nanoc::Helpers
308
308
  require 'builder'
309
309
 
310
310
  # Create builder
311
- builder = AtomFeedBuilder.new(@site, @item)
311
+ builder = AtomFeedBuilder.new(@config, @item)
312
312
 
313
313
  # Fill builder
314
314
  builder.limit = params[:limit] || 5
@@ -316,9 +316,9 @@ module Nanoc::Helpers
316
316
  builder.preserve_order = params.fetch(:preserve_order, false)
317
317
  builder.content_proc = params[:content_proc] || ->(a) { a.compiled_content(snapshot: :pre) }
318
318
  builder.excerpt_proc = params[:excerpt_proc] || ->(a) { a[:excerpt] }
319
- builder.title = params[:title] || @item[:title] || @site.config[:title]
320
- builder.author_name = params[:author_name] || @item[:author_name] || @site.config[:author_name]
321
- builder.author_uri = params[:author_uri] || @item[:author_uri] || @site.config[:author_uri]
319
+ builder.title = params[:title] || @item[:title] || @config[:title]
320
+ builder.author_name = params[:author_name] || @item[:author_name] || @config[:author_name]
321
+ builder.author_uri = params[:author_uri] || @item[:author_uri] || @config[:author_uri]
322
322
  builder.icon = params[:icon]
323
323
  builder.logo = params[:logo]
324
324
 
@@ -330,22 +330,22 @@ module Nanoc::Helpers
330
330
  # Returns the URL for the given item. It will return the URL containing
331
331
  # the custom path in the feed if possible, otherwise the normal path.
332
332
  #
333
- # @param [Nanoc::Item] item The item for which to fetch the URL.
333
+ # @param [Nanoc::Int::Item] item The item for which to fetch the URL.
334
334
  #
335
335
  # @return [String] The URL of the given item
336
336
  def url_for(item)
337
337
  # Check attributes
338
- if @site.config[:base_url].nil?
339
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: site configuration has no base_url')
338
+ if @config[:base_url].nil?
339
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: site configuration has no base_url')
340
340
  end
341
341
 
342
342
  # Build URL
343
343
  if item[:custom_url_in_feed]
344
344
  item[:custom_url_in_feed]
345
345
  elsif item[:custom_path_in_feed]
346
- @site.config[:base_url] + item[:custom_path_in_feed]
346
+ @config[:base_url] + item[:custom_path_in_feed]
347
347
  elsif item.path
348
- @site.config[:base_url] + item.path
348
+ @config[:base_url] + item.path
349
349
  end
350
350
  end
351
351
 
@@ -355,11 +355,11 @@ module Nanoc::Helpers
355
355
  # @return [String] The URL of the feed
356
356
  def feed_url
357
357
  # Check attributes
358
- if @site.config[:base_url].nil?
359
- raise Nanoc::Errors::GenericTrivial.new('Cannot build Atom feed: site configuration has no base_url')
358
+ if @config[:base_url].nil?
359
+ raise Nanoc::Int::Errors::GenericTrivial.new('Cannot build Atom feed: site configuration has no base_url')
360
360
  end
361
361
 
362
- @item[:feed_url] || @site.config[:base_url] + @item.path
362
+ @item[:feed_url] || @config[:base_url] + @item.path
363
363
  end
364
364
 
365
365
  # Returns an URI containing an unique ID for the given item. This will be
@@ -368,15 +368,15 @@ module Nanoc::Helpers
368
368
  # ["How to make a good ID in Atom" blog post]
369
369
  # (http://web.archive.org/web/20110915110202/http://diveintomark.org/archives/2004/05/28/howto-atom-id).
370
370
  #
371
- # @param [Nanoc::Item] item The item for which to create an atom tag
371
+ # @param [Nanoc::Int::Item] item The item for which to create an atom tag
372
372
  #
373
373
  # @return [String] The atom tag for the given item
374
374
  def atom_tag_for(item)
375
- hostname, base_dir = %r{^.+?://([^/]+)(.*)$}.match(@site.config[:base_url])[1..2]
375
+ hostname, base_dir = %r{^.+?://([^/]+)(.*)$}.match(@config[:base_url])[1..2]
376
376
 
377
- formatted_date = attribute_to_time(item[:created_at]).to_iso8601_date
377
+ formatted_date = attribute_to_time(item[:created_at]).__nanoc_to_iso8601_date
378
378
 
379
- 'tag:' + hostname + ',' + formatted_date + ':' + base_dir + (item.path || item.identifier)
379
+ 'tag:' + hostname + ',' + formatted_date + ':' + base_dir + (item.path || item.identifier.to_s)
380
380
  end
381
381
 
382
382
  # Converts the given attribute (which can be a string, a Time or a Date)
@@ -17,11 +17,11 @@ module Nanoc::Helpers
17
17
  idx_start = 0
18
18
 
19
19
  loop do
20
- idx = @item.identifier.index('/', idx_start)
20
+ idx = @item.identifier.to_s.index('/', idx_start)
21
21
  break if idx.nil?
22
22
 
23
23
  idx_start = idx + 1
24
- identifier = @item.identifier[0..idx]
24
+ identifier = @item.identifier.to_s[0..idx]
25
25
  trail << @items[identifier]
26
26
  end
27
27
 
@@ -26,13 +26,6 @@ module Nanoc::Helpers
26
26
  # <h3>Summary</h3>
27
27
  # <%= content_for(@item, :summary) || '(no summary)' %>
28
28
  # </div>
29
- #
30
- # @example Showing captured content in a sidebar the old, deprecated way (do not use or I will become very angry)
31
- #
32
- # <div id="sidebar">
33
- # <h3>Summary</h3>
34
- # <%= @item[:content_for_summary] || '(no summary)' %>
35
- # </div>
36
29
  module Capturing
37
30
  # @api private
38
31
  class CapturesStore
@@ -51,7 +44,7 @@ module Nanoc::Helpers
51
44
  end
52
45
  end
53
46
 
54
- class ::Nanoc::Site
47
+ class ::Nanoc::Int::Site
55
48
  # @api private
56
49
  def captures_store
57
50
  @captures_store ||= CapturesStore.new
@@ -71,11 +64,6 @@ module Nanoc::Helpers
71
64
  # getting the captured content as well as setting it. When capturing,
72
65
  # the content of the block itself will not be outputted.
73
66
  #
74
- # For backwards compatibility, it is also possible to fetch the captured
75
- # content by getting the contents of the attribute named `content_for_`
76
- # followed by the given name. This way of accessing captures is
77
- # deprecated.
78
- #
79
67
  # @param [Symbol, String] name The base name of the attribute into which
80
68
  # the content should be stored
81
69
  #
@@ -86,7 +74,7 @@ module Nanoc::Helpers
86
74
  # Fetches the capture with the given name from the given item and
87
75
  # returns it.
88
76
  #
89
- # @param [Nanoc::Item] item The item for which to get the capture
77
+ # @param [Nanoc::Int::Item] item The item for which to get the capture
90
78
  #
91
79
  # @param [Symbol, String] name The name of the capture to fetch
92
80
  #
@@ -110,13 +98,14 @@ module Nanoc::Helpers
110
98
  "and the name of the capture) but got #{args.size} instead"
111
99
  end
112
100
  item = args[0]
101
+ item = item.unwrap if item.respond_to?(:unwrap)
113
102
  name = args[1]
114
103
 
115
104
  # Create dependency
116
105
  current_item = @site.compiler.dependency_tracker.top
117
106
  if item != current_item
118
- Nanoc::NotificationCenter.post(:visit_started, item)
119
- Nanoc::NotificationCenter.post(:visit_ended, item)
107
+ Nanoc::Int::NotificationCenter.post(:visit_started, item)
108
+ Nanoc::Int::NotificationCenter.post(:visit_ended, item)
120
109
 
121
110
  # This is an extremely ugly hack to get the compiler to recompile the
122
111
  # item from which we use content. For this, we need to manually edit
@@ -128,7 +117,7 @@ module Nanoc::Helpers
128
117
  item.reps.each do |r|
129
118
  raw_content = item.raw_content
130
119
  r.content = { raw: raw_content, last: raw_content }
131
- raise Nanoc::Errors::UnmetDependency.new(r)
120
+ raise Nanoc::Int::Errors::UnmetDependency.new(r)
132
121
  end
133
122
  end
134
123
  end
@@ -32,13 +32,13 @@ module Nanoc::Helpers
32
32
 
33
33
  # Find filter
34
34
  klass = Nanoc::Filter.named(filter_name)
35
- raise Nanoc::Errors::UnknownFilter.new(filter_name) if klass.nil?
35
+ raise Nanoc::Int::Errors::UnknownFilter.new(filter_name) if klass.nil?
36
36
  filter = klass.new(@item_rep.assigns)
37
37
 
38
38
  # Filter captured data
39
- Nanoc::NotificationCenter.post(:filtering_started, @item_rep, filter_name)
39
+ Nanoc::Int::NotificationCenter.post(:filtering_started, @item_rep, filter_name)
40
40
  filtered_data = filter.setup_and_run(data, arguments)
41
- Nanoc::NotificationCenter.post(:filtering_ended, @item_rep, filter_name)
41
+ Nanoc::Int::NotificationCenter.post(:filtering_ended, @item_rep, filter_name)
42
42
 
43
43
  # Append filtered data to buffer
44
44
  buffer = eval('_erbout', block.binding)