Unified · Split
| @@ -53,6 +53,10 @@ module Docs · 52 unmodified lines | |||
| 53 | node.name = 'h4' | 53 | node.name = 'h4' |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | css('thead td').each do |node| | ||
| 57 | node.name = 'th' | ||
| 58 | end | ||
| 59 | |||
| 56 | css('table, tr, td, th, pre, code').each do |node| | 60 | css('table, tr, td, th, pre, code').each do |node| |
| 57 | node.remove_attribute('class') | 61 | node.remove_attribute('class') |
| 58 | node.remove_attribute('style') | 62 | node.remove_attribute('style') |
| @@ -4,24 +4,22 @@ module Docs · 3 unmodified lines | |||
| 4 | def get_name | 4 | def get_name |
| 5 | name = at_css('.bd-content h1').content.strip | 5 | name = at_css('.bd-content h1').content.strip |
| 6 | name.remove! ' system' | 6 | name.remove! ' system' |
| 7 | return type if name == 'Overview' | 7 | name == 'Overview' ? type : name |
| 8 | name.prepend 'Utilities: ' if subpath.start_with?('utilities') | ||
| 9 | name | ||
| 10 | end | 8 | end |
| 11 | 9 | ||
| 12 | def get_type | 10 | def get_type |
| 13 | if subpath.start_with?('components') | 11 | if subpath.start_with?('components') |
| 14 | at_css('.bd-content h1').content.strip.prepend 'Components: ' | 12 | at_css('.bd-content h1').content.strip.prepend 'Components: ' |
| 15 | else | 13 | else |
| 16 | at_css('.bd-pageheader h1').content | 14 | at_css('.bd-toc-item.active > .bd-toc-link').content |
| 17 | end | 15 | end |
| 18 | end | 16 | end |
| 19 | 17 | ||
| 20 | def additional_entries | 18 | def additional_entries |
| 21 | return [] if root_page? || subpath.start_with?('getting-started') | 19 | return [] if root_page? || subpath.start_with?('getting-started') || subpath.start_with?('migration') |
| 22 | entries = [] | 20 | entries = [] |
| 23 | 21 | ||
| 24 | css('#markdown-toc > li > a', '#markdown-toc > li li #markdown-toc-events').each do |node| | 22 | css('.bd-toc > ul > li > a', '.bd-toc a[href="#events"]', '.bd-toc a[href="#methods"]', '.bd-toc a[href="#triggers"]').each do |node| |
| 25 | name = node.content | 23 | name = node.content |
| 26 | next if name =~ /example/i || IGNORE_ENTRIES.include?(name) | 24 | next if name =~ /example/i || IGNORE_ENTRIES.include?(name) |
| 27 | name.downcase! | 25 | name.downcase! |
| @@ -48,17 +46,26 @@ module Docs · 20 unmodified lines | |||
| 48 | entries << [name, id] | 46 | entries << [name, id] |
| 49 | end | 47 | end |
| 50 | 48 | ||
| 49 | css("#events ~ table tbody td:first-child").each do |node| | ||
| 50 | name = node.content.strip | ||
| 51 | unless id = node.parent['id'] | ||
| 52 | id = node.parent['id'] = "#{name.parameterize}-event" | ||
| 53 | end | ||
| 54 | name.prepend "#{self.name}: " | ||
| 55 | name << ' (event)' | ||
| 56 | entries << [name, id] | ||
| 57 | end | ||
| 58 | |||
| 51 | entries | 59 | entries |
| 52 | end | 60 | end |
| 53 | 61 | ||
| 54 | IGNORE_ENTRIES = %w( | 62 | IGNORE_ENTRIES = %w( |
| 55 | Contents | ||
| 56 | How\ it\ works | 63 | How\ it\ works |
| 57 | Approach | 64 | Approach |
| 58 | JavaScript\ behavior | 65 | JavaScript\ behavior |
| 59 | Usage | 66 | Usage |
| 60 | Basics | ||
| 61 | Overview | 67 | Overview |
| 68 | About | ||
| 62 | ) | 69 | ) |
| 63 | end | 70 | end |
| 64 | end | 71 | end |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | code: 'https://github.com/twbs/bootstrap' | 6 | code: 'https://github.com/twbs/bootstrap' |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | options[:trailing_slash] = false | 9 | options[:trailing_slash] = true |
| 10 | 10 | ||
| 11 | options[:attribution] = <<-HTML | 11 | options[:attribution] = <<-HTML |
| 12 | © 2011–2017 Twitter, Inc.<br> | 12 | © 2011–2017 Twitter, Inc.<br> |
| @@ -16,31 +16,23 @@ module Docs · 3 unmodified lines | |||
| 16 | HTML | 16 | HTML |
| 17 | 17 | ||
| 18 | version '4' do | 18 | version '4' do |
| 19 | self.release = 'alpha.6' | 19 | self.release = '4.0.0-beta' |
| 20 | self.base_url = 'https://v4-alpha.getbootstrap.com/' | 20 | self.base_url = 'https://getbootstrap.com/docs/4.0/' |
| 21 | self.root_path = 'getting-started/introduction' | 21 | self.root_path = 'getting-started/introduction/' |
| 22 | 22 | ||
| 23 | html_filters.push 'bootstrap/entries_v4', 'bootstrap/clean_html_v4' | 23 | html_filters.push 'bootstrap/entries_v4', 'bootstrap/clean_html_v4' |
| 24 | 24 | ||
| 25 | options[:only_patterns] = [/\Agetting-started\//, /\Alayout\//, /\Acontent\//, /\Acomponents\//, /\Autilities\//] | 25 | options[:only_patterns] = [/\Agetting-started\//, /\Alayout\//, /\Acontent\//, /\Acomponents\//, /\Autilities\//, /\Amigration\//] |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | version '3' do | 28 | version '3' do |
| 29 | self.release = '3.3.7' | 29 | self.release = '3.3.7' |
| 30 | self.base_url = 'https://getbootstrap.com/' | 30 | self.base_url = 'https://getbootstrap.com/docs/3.3/' |
| 31 | self.root_path = 'getting-started' | 31 | self.root_path = 'getting-started/' |
| 32 | 32 | ||
| 33 | html_filters.push 'bootstrap/entries_v3', 'bootstrap/clean_html_v3' | 33 | html_filters.push 'bootstrap/entries_v3', 'bootstrap/clean_html_v3' |
| 34 | 34 | ||
| 35 | options[:only] = %w(getting-started css components javascript) | 35 | options[:only] = %w(getting-started/ css/ components/ javascript/) |
| 36 | end | ||
| 37 | |||
| 38 | private | ||
| 39 | |||
| 40 | def handle_response(response) | ||
| 41 | response.effective_url.scheme = 'https' | ||
| 42 | response.effective_url.path = response.effective_url.path.remove(/\/\z/) | ||
| 43 | super | ||
| 44 | end | 36 | end |
| 45 | end | 37 | end |
| 46 | end | 38 | end |