Unified · Split
| @@ -25,7 +25,7 @@ module Docs · 24 unmodified lines | |||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | def skip_links? | 27 | def skip_links? |
| 28 | context[:skip_links] && context[:skip_links].call(self) | 28 | context[:skip_links].is_a?(Proc) ? context[:skip_links].call(self) : context[:skip_links] |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | def follow_links? | 31 | def follow_links? |
| @@ -10,7 +10,7 @@ module Docs · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | options[:title] = 'Backbone.js' | 11 | options[:title] = 'Backbone.js' |
| 12 | options[:container] = '.container' | 12 | options[:container] = '.container' |
| 13 | options[:skip_links] = ->(filter) { true } | 13 | options[:skip_links] = true |
| 14 | 14 | ||
| 15 | options[:attribution] = <<-HTML | 15 | options[:attribution] = <<-HTML |
| 16 | © 2010–2013 Jeremy Ashkenas, DocumentCloud<br> | 16 | © 2010–2013 Jeremy Ashkenas, DocumentCloud<br> |
| @@ -9,7 +9,7 @@ module Docs · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | options[:title] = 'CoffeeScript' | 10 | options[:title] = 'CoffeeScript' |
| 11 | options[:container] = '.container' | 11 | options[:container] = '.container' |
| 12 | options[:skip_links] = ->(filter) { true } | 12 | options[:skip_links] = true |
| 13 | 13 | ||
| 14 | options[:attribution] = <<-HTML | 14 | options[:attribution] = <<-HTML |
| 15 | © 2009–2013 Jeremy Ashkenas<br> | 15 | © 2009–2013 Jeremy Ashkenas<br> |
| @@ -8,7 +8,7 @@ module Docs · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | options[:title] = 'LESS' | 9 | options[:title] = 'LESS' |
| 10 | options[:container] = 'section' | 10 | options[:container] = 'section' |
| 11 | options[:skip_links] = ->(filter) { true } | 11 | options[:skip_links] = true |
| 12 | 12 | ||
| 13 | options[:attribution] = <<-HTML | 13 | options[:attribution] = <<-HTML |
| 14 | © 2009–2013 Alexis Sellier & The Core Less Team<br> | 14 | © 2009–2013 Alexis Sellier & The Core Less Team<br> |
| @@ -10,7 +10,7 @@ module Docs · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | options[:title] = 'Lo-Dash' | 11 | options[:title] = 'Lo-Dash' |
| 12 | options[:container] = 'h1+div+div' | 12 | options[:container] = 'h1+div+div' |
| 13 | options[:skip_links] = ->(filter) { true } | 13 | options[:skip_links] = true |
| 14 | 14 | ||
| 15 | options[:attribution] = <<-HTML | 15 | options[:attribution] = <<-HTML |
| 16 | © 2012–2013 The Dojo Foundation<br> | 16 | © 2012–2013 The Dojo Foundation<br> |
| @@ -10,7 +10,7 @@ module Docs · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | options[:title] = 'Underscore.js' | 11 | options[:title] = 'Underscore.js' |
| 12 | options[:container] = '#documentation' | 12 | options[:container] = '#documentation' |
| 13 | options[:skip_links] = ->(filter) { true } | 13 | options[:skip_links] = true |
| 14 | 14 | ||
| 15 | options[:attribution] = <<-HTML | 15 | options[:attribution] = <<-HTML |
| 16 | © 2009–2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors<br> | 16 | © 2009–2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors<br> |
| @@ -285,6 +285,20 @@ class InternalUrlsFilterTest < MiniTest::Spec · 284 unmodified lines | |||
| 285 | @body = link_to context[:url] | 285 | @body = link_to context[:url] |
| 286 | end | 286 | end |
| 287 | 287 | ||
| 288 | context "when it is true" do | ||
| 289 | before do | ||
| 290 | context[:skip_links] = true | ||
| 291 | end | ||
| 292 | |||
| 293 | it "doesn't set :internal_urls" do | ||
| 294 | refute internal_urls | ||
| 295 | end | ||
| 296 | |||
| 297 | it "doesn't replace urls" do | ||
| 298 | assert_equal @body, filter_output_string | ||
| 299 | end | ||
| 300 | end | ||
| 301 | |||
| 288 | context "when it is a block" do | 302 | context "when it is a block" do |
| 289 | it "calls the block with the filter instance" do | 303 | it "calls the block with the filter instance" do |
| 290 | context[:skip_links] = ->(arg) { @arg = arg; nil } | 304 | context[:skip_links] = ->(arg) { @arg = arg; nil } |