Showing the changes to lib/docs (6 of 7 files). Show all
Unified · Split
| @@ -3,10 +3,10 @@ require 'set' · 2 unmodified lines | |||
| 3 | module Docs | 3 | module Docs |
| 4 | class InternalUrlsFilter < Filter | 4 | class InternalUrlsFilter < Filter |
| 5 | def call | 5 | def call |
| 6 | return doc if skip_links? | ||
| 6 | internal_urls = Set.new if follow_links? | 7 | internal_urls = Set.new if follow_links? |
| 7 | 8 | ||
| 8 | css('a').each do |link| | 9 | css('a').each do |link| |
| 9 | next if skip_link?(link) | ||
| 10 | next unless url = parse_href(link['href']) | 10 | next unless url = parse_href(link['href']) |
| 11 | next unless subpath = subpath_to(url) | 11 | next unless subpath = subpath_to(url) |
| 12 | 12 | ||
| @@ -24,12 +24,12 @@ module Docs · 11 unmodified lines | |||
| 24 | doc | 24 | doc |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | def follow_links? | 27 | def skip_links? |
| 28 | !(context[:follow_links] && context[:follow_links].call(self) == false) | 28 | context[:skip_links] && context[:skip_links].call(self) |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | def skip_link?(link) | 31 | def follow_links? |
| 32 | context[:skip_links] && context[:skip_links].call(link) | 32 | !(context[:follow_links] && context[:follow_links].call(self) == false) |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | def parse_href(str) | 35 | def parse_href(str) |
| @@ -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] = -> (_) { true } | 13 | options[:skip_links] = ->(filter) { 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] = -> (_) { true } | 12 | options[:skip_links] = ->(filter) { 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] = -> (_) { true } | 11 | options[:skip_links] = ->(filter) { 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] = -> (_) { true } | 13 | options[:skip_links] = ->(filter) { 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] = -> (_) { true } | 13 | options[:skip_links] = ->(filter) { 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> |