History

Update Git documentation (2.9.0)

Fixes #422.

Thibaut Courouble committed 10 years ago

Commit 04786901 parent 203903f3 files · +25 −6Browse files

Unified · Split

3 files
  1. lib/docs/filters/git/clean_html.rb +5 −0
  2. lib/docs/filters/git/entries.rb +15 −1
  3. lib/docs/scrapers/git.rb +5 −5
lib/docs/filters/git/clean_html.rb+5−0
@@ -2,6 +2,7 @@ module Docs · 1 unmodified line
2 class Git2 class Git
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 @doc = at_css('.man-page, #main')
5 root_page? ? root : other6 root_page? ? root : other
6 doc7 doc
7 end8 end
@@ -38,6 +39,10 @@ module Docs · 30 unmodified lines
38 css('tt', 'p > em').each do |node|39 css('tt', 'p > em').each do |node|
39 node.name = 'code'40 node.name = 'code'
40 end41 end
42
43 css('pre').each do |node|
44 node.content = node.content.gsub("\t", ' ' * 8)
45 end
41 end46 end
42 end47 end
43 end48 end
lib/docs/filters/git/entries.rb+15−1
@@ -2,7 +2,21 @@ module Docs · 1 unmodified line
2 class Git2 class Git
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 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 end20 end
7 end21 end
8 end22 end
lib/docs/scrapers/git.rb+5−5
@@ -1,7 +1,7 @@
1module Docs1module Docs
2 class Git < UrlScraper2 class Git < UrlScraper
3 self.type = 'git'3 self.type = 'git'
4 self.release = '2.8.0'4 self.release = '2.9.0'
5 self.base_url = 'https://git-scm.com/docs'5 self.base_url = 'https://git-scm.com/docs'
6 self.initial_paths = %w(/git.html)6 self.initial_paths = %w(/git.html)
7 self.links = {7 self.links = {
@@ -9,11 +9,11 @@ module Docs · 1 unmodified line
9 code: 'https://github.com/git/git'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' }14 options[:container] = '#content'
15 options[:follow_links] = ->(filter) { filter.root_page? }15 options[:only_patterns] = [/\A\/[^\/]+\z/]
16 options[:only_patterns] = [/\A\/git\-/]16 options[:skip] = %w(/howto-index.html)
17 17
18 options[:attribution] = <<-HTML18 options[:attribution] = <<-HTML
19 &copy; 2005&ndash;2016 Linus Torvalds and others<br>19 &copy; 2005&ndash;2016 Linus Torvalds and others<br>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t