Update Git documentation (2.9.0)

Fixes #422.
pull/427/head
Thibaut Courouble 9 years ago
parent 203903fe95
commit 0478690c19

@ -2,6 +2,7 @@ module Docs
class Git class Git
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
@doc = at_css('.man-page, #main')
root_page? ? root : other root_page? ? root : other
doc doc
end end
@ -38,6 +39,10 @@ module Docs
css('tt', 'p > em').each do |node| css('tt', 'p > em').each do |node|
node.name = 'code' node.name = 'code'
end end
css('pre').each do |node|
node.content = node.content.gsub("\t", ' ' * 8)
end
end end
end end
end end

@ -2,8 +2,22 @@ module Docs
class Git class Git
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
if slug == 'user-manual'
'User Manual'
else
slug.sub '-', ' ' slug.sub '-', ' '
end end
end end
def get_type
if link = at_css("#topics-dropdown a[href='#{slug}']")
link.ancestors('ul').first.previous_element.content
elsif slug == 'git' || slug.start_with?('git-')
'Git'
else
'Miscellaenous'
end
end
end
end end
end end

@ -1,7 +1,7 @@
module Docs module Docs
class Git < UrlScraper class Git < UrlScraper
self.type = 'git' self.type = 'git'
self.release = '2.8.0' self.release = '2.9.0'
self.base_url = 'https://git-scm.com/docs' self.base_url = 'https://git-scm.com/docs'
self.initial_paths = %w(/git.html) self.initial_paths = %w(/git.html)
self.links = { self.links = {
@ -9,11 +9,11 @@ module Docs
code: 'https://github.com/git/git' code: 'https://github.com/git/git'
} }
html_filters.push 'git/clean_html', 'git/entries' html_filters.push 'git/entries', 'git/clean_html'
options[:container] = ->(filter) { filter.root_page? ? '#main' : '.man-page, #main' } options[:container] = '#content'
options[:follow_links] = ->(filter) { filter.root_page? } options[:only_patterns] = [/\A\/[^\/]+\z/]
options[:only_patterns] = [/\A\/git\-/] options[:skip] = %w(/howto-index.html)
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2005&ndash;2016 Linus Torvalds and others<br> &copy; 2005&ndash;2016 Linus Torvalds and others<br>

Loading…
Cancel
Save