Fixes #422.
Unified · Split
| @@ -2,6 +2,7 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Git |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | + @doc = at_css('.man-page, #main') | |
| 5 | 6 | root_page? ? root : other |
| 6 | 7 | doc |
| 7 | 8 | end |
| @@ -38,6 +39,10 @@ module Docs · 30 unmodified lines | ||
| 38 | 39 | css('tt', 'p > em').each do |node| |
| 39 | 40 | node.name = 'code' |
| 40 | 41 | end |
| 42 | + | |
| 43 | + css('pre').each do |node| | |
| 44 | + node.content = node.content.gsub("\t", ' ' * 8) | |
| 45 | + end | |
| 41 | 46 | end |
| 42 | 47 | end |
| 43 | 48 | end |
| @@ -2,7 +2,21 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Git |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − slug.sub '-', ' ' | |
| 5 | + if slug == 'user-manual' | |
| 6 | + 'User Manual' | |
| 7 | + else | |
| 8 | + slug.sub '-', ' ' | |
| 9 | + end | |
| 10 | + end | |
| 11 | + | |
| 12 | + def get_type | |
| 13 | + if link = at_css("#topics-dropdown a[href='#{slug}']") | |
| 14 | + link.ancestors('ul').first.previous_element.content | |
| 15 | + elsif slug == 'git' || slug.start_with?('git-') | |
| 16 | + 'Git' | |
| 17 | + else | |
| 18 | + 'Miscellaenous' | |
| 19 | + end | |
| 6 | 20 | end |
| 7 | 21 | end |
| 8 | 22 | end |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Git < UrlScraper |
| 3 | 3 | self.type = 'git' |
| 4 | − self.release = '2.8.0' | |
| 4 | + self.release = '2.9.0' | |
| 5 | 5 | self.base_url = 'https://git-scm.com/docs' |
| 6 | 6 | self.initial_paths = %w(/git.html) |
| 7 | 7 | self.links = { |
| @@ -9,11 +9,11 @@ module Docs · 1 unmodified line | ||
| 9 | 9 | code: 'https://github.com/git/git' |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | − html_filters.push 'git/clean_html', 'git/entries' | |
| 12 | + html_filters.push 'git/entries', 'git/clean_html' | |
| 13 | 13 | |
| 14 | − options[:container] = ->(filter) { filter.root_page? ? '#main' : '.man-page, #main' } | |
| 15 | − options[:follow_links] = ->(filter) { filter.root_page? } | |
| 16 | − options[:only_patterns] = [/\A\/git\-/] | |
| 14 | + options[:container] = '#content' | |
| 15 | + options[:only_patterns] = [/\A\/[^\/]+\z/] | |
| 16 | + options[:skip] = %w(/howto-index.html) | |
| 17 | 17 | |
| 18 | 18 | options[:attribution] = <<-HTML |
| 19 | 19 | © 2005–2016 Linus Torvalds and others<br> |