nanoc 3.7.3 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
@@ -16,12 +16,12 @@ module Nanoc::Extra
|
|
16
16
|
def freeze
|
17
17
|
end
|
18
18
|
|
19
|
-
def respond_to?(meth,
|
19
|
+
def respond_to?(meth, _include_all = false)
|
20
20
|
file_instance_methods.include?(meth.to_sym)
|
21
21
|
end
|
22
22
|
|
23
23
|
def method_missing(sym, *args, &block)
|
24
|
-
|
24
|
+
unless @@deprecation_warning_shown
|
25
25
|
$stderr.puts 'WARNING: The :file attribute is deprecated and will be removed in a future version of nanoc. Instead of using this :file attribute, consider manually creating a File object when it’s needed, using the :content_filename, :meta_filename or :filename attributes.'
|
26
26
|
@@deprecation_warning_shown = true
|
27
27
|
end
|
@@ -29,7 +29,7 @@ module Nanoc::Extra
|
|
29
29
|
File.open(@path, 'r') { |io| io.__send__(sym, *args, &block) }
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
private
|
33
33
|
|
34
34
|
def file_instance_methods
|
35
35
|
@@file_instance_methods ||= Set.new(File.instance_methods.map { |m| m.to_sym })
|
@@ -13,7 +13,7 @@ module ::Nanoc::Extra
|
|
13
13
|
@filter =
|
14
14
|
case mode
|
15
15
|
when nil
|
16
|
-
lambda { |
|
16
|
+
lambda { |_h| true }
|
17
17
|
when :external
|
18
18
|
lambda { |h| external_href?(h) }
|
19
19
|
when :internal
|
@@ -36,7 +36,7 @@ module ::Nanoc::Extra
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def external_href?(href)
|
39
|
-
|
39
|
+
href =~ %r{^(\/\/|[a-z\-]+:)}
|
40
40
|
end
|
41
41
|
|
42
42
|
def hrefs_in_file(filename)
|
@@ -47,7 +47,7 @@ module ::Nanoc::Extra
|
|
47
47
|
|
48
48
|
# Convert protocol-relative urls
|
49
49
|
# e.g. //example.com => http://example.com
|
50
|
-
hrefs_in_file.map! { |href| href.gsub
|
50
|
+
hrefs_in_file.map! { |href| href.gsub(/^\/\//, 'http://') }
|
51
51
|
|
52
52
|
# Strip fragment
|
53
53
|
hrefs_in_file.map! { |href| href.gsub(/#.*$/, '') }
|
data/lib/nanoc/extra/piper.rb
CHANGED
@@ -21,7 +21,7 @@ module Nanoc::Extra
|
|
21
21
|
|
22
22
|
# @option [IO] :stdout ($stdout)
|
23
23
|
# @option [IO] :stderr ($stderr)
|
24
|
-
def initialize(params={})
|
24
|
+
def initialize(params = {})
|
25
25
|
@stdout = params.fetch(:stdout, $stdout)
|
26
26
|
@stderr = params.fetch(:stderr, $stderr)
|
27
27
|
end
|
@@ -43,7 +43,7 @@ module Nanoc::Extra
|
|
43
43
|
stderr_thread.join
|
44
44
|
|
45
45
|
exit_status = wait_thr.value
|
46
|
-
|
46
|
+
unless exit_status.success?
|
47
47
|
raise Error.new(cmd, exit_status.to_i)
|
48
48
|
end
|
49
49
|
end
|
data/lib/nanoc/extra/pruner.rb
CHANGED
@@ -27,11 +27,12 @@ module Nanoc::Extra
|
|
27
27
|
require 'find'
|
28
28
|
|
29
29
|
# Get compiled files
|
30
|
-
|
30
|
+
all_raw_paths = site.items.map do |item|
|
31
31
|
item.reps.map do |rep|
|
32
32
|
rep.raw_path
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
35
|
+
compiled_files = all_raw_paths.flatten.compact.select { |f| File.file?(f) }
|
35
36
|
|
36
37
|
# Get present files and dirs
|
37
38
|
present_files = []
|
@@ -64,7 +65,7 @@ module Nanoc::Extra
|
|
64
65
|
@exclude.any? { |e| pathname.include_component?(e) }
|
65
66
|
end
|
66
67
|
|
67
|
-
|
68
|
+
protected
|
68
69
|
|
69
70
|
def delete_file(file)
|
70
71
|
if @dry_run
|
@@ -5,7 +5,7 @@ module Nanoc::Extra::Validators
|
|
5
5
|
# @deprecated Use the Checking API or the `check` command instead
|
6
6
|
class Links
|
7
7
|
|
8
|
-
def initialize(
|
8
|
+
def initialize(_dir, _index_filenames, params = {})
|
9
9
|
@include_internal = params.key?(:internal) && params[:internal]
|
10
10
|
@include_external = params.key?(:external) && params[:external]
|
11
11
|
end
|
@@ -14,7 +14,7 @@ module Nanoc::Extra::Validators
|
|
14
14
|
checks = []
|
15
15
|
checks << 'ilinks' if options[:internal]
|
16
16
|
checks << 'elinks' if options[:external]
|
17
|
-
Nanoc::CLI.run [
|
17
|
+
Nanoc::CLI.run ['check', checks].flatten
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
data/lib/nanoc/extra/vcs.rb
CHANGED
@@ -20,7 +20,7 @@ module Nanoc::Extra
|
|
20
20
|
# @return [void]
|
21
21
|
#
|
22
22
|
# @abstract
|
23
|
-
def add(
|
23
|
+
def add(_filename)
|
24
24
|
not_implemented('add')
|
25
25
|
end
|
26
26
|
|
@@ -33,7 +33,7 @@ module Nanoc::Extra
|
|
33
33
|
# @return [void]
|
34
34
|
#
|
35
35
|
# @abstract
|
36
|
-
def remove(
|
36
|
+
def remove(_filename)
|
37
37
|
not_implemented('remove')
|
38
38
|
end
|
39
39
|
|
@@ -48,15 +48,15 @@ module Nanoc::Extra
|
|
48
48
|
# @return [void]
|
49
49
|
#
|
50
50
|
# @abstract
|
51
|
-
def move(
|
51
|
+
def move(_src, _dst)
|
52
52
|
not_implemented('move')
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
private
|
56
56
|
|
57
57
|
def not_implemented(name)
|
58
58
|
raise NotImplementedError.new(
|
59
|
-
"#{self.class} does not override ##{name}, which is required for "
|
59
|
+
"#{self.class} does not override ##{name}, which is required for " \
|
60
60
|
'this data source to be used.'
|
61
61
|
)
|
62
62
|
end
|
@@ -11,7 +11,7 @@ module Nanoc::Filters
|
|
11
11
|
# @param [String] content The content to filter
|
12
12
|
#
|
13
13
|
# @return [String] The filtered content
|
14
|
-
def run(content,
|
14
|
+
def run(content, _params = {})
|
15
15
|
stdout = StringIO.new
|
16
16
|
stderr = $stderr
|
17
17
|
piper = Nanoc::Extra::Piper.new(:stdout => stdout, :stderr => stderr)
|
@@ -13,7 +13,7 @@ module Nanoc::Filters
|
|
13
13
|
# @param [String] content The CoffeeScript content to turn into JavaScript
|
14
14
|
#
|
15
15
|
# @return [String] The resulting JavaScript
|
16
|
-
def run(content,
|
16
|
+
def run(content, _params = {})
|
17
17
|
::CoffeeScript.compile(content)
|
18
18
|
end
|
19
19
|
|
@@ -159,18 +159,16 @@ module Nanoc::Filters
|
|
159
159
|
#
|
160
160
|
# @api private
|
161
161
|
def parse(content, klass, is_fullpage)
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
raise e
|
173
|
-
end
|
162
|
+
if is_fullpage
|
163
|
+
klass.parse(content, nil, 'UTF-8')
|
164
|
+
else
|
165
|
+
klass.fragment(content)
|
166
|
+
end
|
167
|
+
rescue => e
|
168
|
+
if e.message =~ /can't modify frozen string/
|
169
|
+
parse(content.dup, klass, is_fullpage)
|
170
|
+
else
|
171
|
+
raise e
|
174
172
|
end
|
175
173
|
end
|
176
174
|
|
@@ -199,7 +197,7 @@ module Nanoc::Filters
|
|
199
197
|
#
|
200
198
|
# @return [String] The colorized output, which is identical to the input
|
201
199
|
# in this case
|
202
|
-
def dummy(code,
|
200
|
+
def dummy(code, _language, _params = {})
|
203
201
|
code
|
204
202
|
end
|
205
203
|
|
@@ -221,7 +219,7 @@ module Nanoc::Filters
|
|
221
219
|
params[:encoding] ||= 'utf-8'
|
222
220
|
params[:nowrap] ||= 'True'
|
223
221
|
|
224
|
-
cmd = [
|
222
|
+
cmd = ['pygmentize', '-l', language, '-f', 'html']
|
225
223
|
cmd << '-O' << params.map { |k, v| "#{k}=#{v}" }.join(',') unless params.empty?
|
226
224
|
|
227
225
|
stdout = StringIO.new
|
@@ -276,8 +274,8 @@ module Nanoc::Filters
|
|
276
274
|
def simon_highlight(code, language, params = {})
|
277
275
|
check_availability('highlight', '--version')
|
278
276
|
|
279
|
-
cmd = [
|
280
|
-
params.each do |key,
|
277
|
+
cmd = ['highlight', '--syntax', language, '--fragment']
|
278
|
+
params.each do |key, _value|
|
281
279
|
if SIMON_HIGHLIGHT_OPT_MAP[key]
|
282
280
|
cmd << SIMON_HIGHLIGHT_OPT_MAP[key]
|
283
281
|
else
|
@@ -298,7 +296,7 @@ module Nanoc::Filters
|
|
298
296
|
end
|
299
297
|
|
300
298
|
# Wraps the element in <div class="CodeRay"><div class="code">
|
301
|
-
def coderay_postprocess(
|
299
|
+
def coderay_postprocess(_language, element)
|
302
300
|
# Skip if we're a free <code>
|
303
301
|
return if element.parent.nil?
|
304
302
|
|
@@ -345,7 +343,7 @@ module Nanoc::Filters
|
|
345
343
|
# After:
|
346
344
|
#
|
347
345
|
# <pre><code class="language-ruby highlight">
|
348
|
-
def rouge_postprocess(
|
346
|
+
def rouge_postprocess(_language, element)
|
349
347
|
return if element.name != 'pre'
|
350
348
|
|
351
349
|
code1 = element.xpath('code').first
|
@@ -354,12 +352,12 @@ module Nanoc::Filters
|
|
354
352
|
return if code2.nil?
|
355
353
|
|
356
354
|
code1.inner_html = code2.inner_html
|
357
|
-
code1['class'] = [
|
355
|
+
code1['class'] = [code1['class'], code2['class']].compact.join(' ')
|
358
356
|
end
|
359
357
|
|
360
|
-
|
358
|
+
protected
|
361
359
|
|
362
|
-
KNOWN_COLORIZERS = [
|
360
|
+
KNOWN_COLORIZERS = [:coderay, :dummy, :pygmentize, :pygmentsrb, :simon_highlight, :rouge]
|
363
361
|
|
364
362
|
# Removes the first blank lines and any whitespace at the end.
|
365
363
|
def strip(s)
|
data/lib/nanoc/filters/erubis.rb
CHANGED
@@ -15,7 +15,7 @@ module Nanoc::Filters
|
|
15
15
|
# @param [String] content The content to filter
|
16
16
|
#
|
17
17
|
# @return [String] The filtered content
|
18
|
-
def run(content,
|
18
|
+
def run(content, _params = {})
|
19
19
|
context = item.attributes.dup
|
20
20
|
context[:item] = assigns[:item].attributes
|
21
21
|
context[:config] = assigns[:config]
|
data/lib/nanoc/filters/less.rb
CHANGED
@@ -30,7 +30,7 @@ module Nanoc::Filters
|
|
30
30
|
if imported_pathname.relative?
|
31
31
|
imported_pathname = current_dir_pathname + imported_pathname
|
32
32
|
end
|
33
|
-
next
|
33
|
+
next unless imported_pathname.exist?
|
34
34
|
imported_filename = imported_pathname.realpath
|
35
35
|
|
36
36
|
# Find matching item
|
@@ -44,7 +44,7 @@ module Nanoc::Filters
|
|
44
44
|
depend_on(imported_items)
|
45
45
|
|
46
46
|
# Add filename to load path
|
47
|
-
paths = [
|
47
|
+
paths = [File.dirname(@item[:content_filename])]
|
48
48
|
parser = ::Less::Parser.new(:paths => paths)
|
49
49
|
parser.parse(content).to_css params
|
50
50
|
end
|
@@ -11,7 +11,7 @@ module Nanoc::Filters
|
|
11
11
|
# @param [String] content The content to filter
|
12
12
|
#
|
13
13
|
# @return [String] The filtered content
|
14
|
-
def run(content,
|
14
|
+
def run(content, _params = {})
|
15
15
|
# Get result
|
16
16
|
::Markaby::Builder.new(assigns).instance_eval(content).to_s
|
17
17
|
end
|
@@ -14,7 +14,7 @@ module Nanoc::Filters
|
|
14
14
|
# @param [String] content The content to filter
|
15
15
|
#
|
16
16
|
# @return [String] The filtered content
|
17
|
-
def run(content,
|
17
|
+
def run(content, _params = {})
|
18
18
|
context = item.attributes.merge({ :yield => assigns[:content] })
|
19
19
|
::Mustache.render(content, context)
|
20
20
|
end
|
data/lib/nanoc/filters/rdoc.rb
CHANGED
@@ -16,7 +16,7 @@ module Nanoc::Filters
|
|
16
16
|
# @param [String] content The content to filter
|
17
17
|
#
|
18
18
|
# @return [String] The filtered content
|
19
|
-
def run(content,
|
19
|
+
def run(content, _params = {})
|
20
20
|
options = ::RDoc::Options.new
|
21
21
|
to_html = ::RDoc::Markup::ToHtml.new(options)
|
22
22
|
::RDoc::Markup.new.convert(content, to_html)
|
@@ -6,7 +6,7 @@ module Nanoc::Filters
|
|
6
6
|
require 'nanoc/helpers/link_to'
|
7
7
|
include Nanoc::Helpers::LinkTo
|
8
8
|
|
9
|
-
SELECTORS = [
|
9
|
+
SELECTORS = ['*/@href', '*/@src', 'object/@data', 'param[@name="movie"]/@content', 'comment()']
|
10
10
|
|
11
11
|
# Relativizes all paths in the given content, which can be HTML, XHTML, XML
|
12
12
|
# or CSS. This filter is quite useful if a site needs to be hosted in a
|
@@ -63,13 +63,13 @@ module Nanoc::Filters
|
|
63
63
|
nokogiri_process(content, selectors, namespaces, klass, params[:type])
|
64
64
|
else
|
65
65
|
raise RuntimeError.new(
|
66
|
-
'The relativize_paths needs to know the type of content to '
|
67
|
-
'process. Pass a :type to the filter call (:html for HTML, '
|
66
|
+
'The relativize_paths needs to know the type of content to ' \
|
67
|
+
'process. Pass a :type to the filter call (:html for HTML, ' \
|
68
68
|
':xhtml for XHTML, :xml for XML, or :css for CSS).')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
protected
|
73
73
|
|
74
74
|
def nokogiri_process(content, selectors, namespaces, klass, type)
|
75
75
|
# Ensure that all prefixes are strings
|
@@ -80,7 +80,7 @@ module Nanoc::Filters
|
|
80
80
|
doc.xpath(selector, namespaces).each do |node|
|
81
81
|
if node.name == 'comment'
|
82
82
|
content = node.content.dup
|
83
|
-
content = content.sub(%r{^(\s*\[.+?\]>\s*)(.+?)(\s*<!\[endif\])}m) do |
|
83
|
+
content = content.sub(%r{^(\s*\[.+?\]>\s*)(.+?)(\s*<!\[endif\])}m) do |_m|
|
84
84
|
fragment = nokogiri_process($2, selectors, namespaces, klass, type)
|
85
85
|
$1 + fragment + $3
|
86
86
|
end
|
@@ -12,7 +12,7 @@ class ::Sass::Importers::Filesystem
|
|
12
12
|
# Create dependency
|
13
13
|
filter = options[:nanoc_current_filter]
|
14
14
|
item = filter.imported_filename_to_item(full_filename)
|
15
|
-
filter.depend_on([
|
15
|
+
filter.depend_on([item]) unless item.nil?
|
16
16
|
|
17
17
|
# Call original _find
|
18
18
|
_orig_find(dir, name, options)
|
data/lib/nanoc/filters/xsl.rb
CHANGED
@@ -87,7 +87,7 @@ module Nanoc::Helpers
|
|
87
87
|
buffer
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
protected
|
91
91
|
|
92
92
|
def sorted_relevant_articles
|
93
93
|
relevant_articles.sort_by do |a|
|
@@ -132,8 +132,8 @@ module Nanoc::Helpers
|
|
132
132
|
root_url = @site.config[:base_url] + '/'
|
133
133
|
|
134
134
|
# Add primary attributes
|
135
|
-
xml.id
|
136
|
-
xml.title
|
135
|
+
xml.id root_url
|
136
|
+
xml.title title
|
137
137
|
|
138
138
|
# Add date
|
139
139
|
xml.updated(attribute_to_time(last_article[:created_at]).to_iso8601_time)
|
@@ -144,8 +144,8 @@ module Nanoc::Helpers
|
|
144
144
|
|
145
145
|
# Add author information
|
146
146
|
xml.author do
|
147
|
-
xml.name
|
148
|
-
xml.uri
|
147
|
+
xml.name author_name
|
148
|
+
xml.uri author_uri
|
149
149
|
end
|
150
150
|
|
151
151
|
# Add icon and logo
|
@@ -166,18 +166,18 @@ module Nanoc::Helpers
|
|
166
166
|
|
167
167
|
xml.entry do
|
168
168
|
# Add primary attributes
|
169
|
-
xml.id
|
170
|
-
xml.title
|
169
|
+
xml.id atom_tag_for(a)
|
170
|
+
xml.title a[:title], :type => 'html'
|
171
171
|
|
172
172
|
# Add dates
|
173
173
|
xml.published attribute_to_time(a[:created_at]).to_iso8601_time
|
174
|
-
xml.updated
|
174
|
+
xml.updated attribute_to_time(a[:updated_at] || a[:created_at]).to_iso8601_time
|
175
175
|
|
176
176
|
# Add specific author information
|
177
177
|
if a[:author_name] || a[:author_uri]
|
178
178
|
xml.author do
|
179
|
-
xml.name
|
180
|
-
xml.uri
|
179
|
+
xml.name a[:author_name] || author_name
|
180
|
+
xml.uri a[:author_uri] || author_uri
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -186,8 +186,8 @@ module Nanoc::Helpers
|
|
186
186
|
|
187
187
|
# Add content
|
188
188
|
summary = excerpt_proc.call(a)
|
189
|
-
xml.content
|
190
|
-
xml.summary
|
189
|
+
xml.content content_proc.call(a), :type => 'html'
|
190
|
+
xml.summary summary, :type => 'html' unless summary.nil?
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|