History

Fix merge conflict

Jasper van Merle committed 8 years ago

Commit 536fa352 parents e894a2f e8d52c9175 files · +2496 −1111Browse files

Showing the changes to lib/docs (73 of 175 files). Show all

Unified · Split

73 files
  1. lib/docs/filters/bash/clean_html.rb +74 −0
  2. lib/docs/filters/bash/entries.rb +56 −0
  3. lib/docs/filters/dart/clean_html.rb +66 −0
  4. lib/docs/filters/dart/entries.rb +42 −0
  5. lib/docs/filters/dom/entries.rb +3 −0
  6. lib/docs/filters/elixir/clean_html.rb +1 −0
  7. lib/docs/filters/express/clean_html.rb +5 −0
  8. lib/docs/filters/graphite/clean_html.rb +27 −0
  9. lib/docs/filters/graphite/entries.rb +46 −0
  10. lib/docs/filters/handlebars/clean_html.rb +44 −0
  11. lib/docs/filters/handlebars/entries.rb +19 −0
  12. lib/docs/filters/puppeteer/clean_html.rb +24 −0
  13. lib/docs/filters/puppeteer/entries.rb +41 −0
  14. lib/docs/filters/pygame/clean_html.rb +102 −0
  15. lib/docs/filters/pygame/entries.rb +29 −0
  16. lib/docs/filters/python/clean_html.rb +5 −3
  17. lib/docs/filters/python/entries_v3.rb +12 −10
  18. lib/docs/filters/qt/clean_html.rb +31 −0
  19. lib/docs/filters/qt/entries.rb +141 −0
  20. lib/docs/filters/redis/entries.rb +2 −1
  21. lib/docs/filters/rust/clean_html.rb +37 −6
  22. lib/docs/filters/rust/entries.rb +8 −5
  23. lib/docs/filters/typescript/entries.rb +1 −0
  24. lib/docs/scrapers/apache.rb +1 −1
  25. lib/docs/scrapers/apache_pig.rb +1 −1
  26. lib/docs/scrapers/bash.rb +21 −0
  27. lib/docs/scrapers/bootstrap.rb +1 −1
  28. lib/docs/scrapers/bower.rb +1 −1
  29. lib/docs/scrapers/chai.rb +1 −1
  30. lib/docs/scrapers/cmake.rb +12 −2
  31. lib/docs/scrapers/codeceptjs.rb +1 −1
  32. lib/docs/scrapers/crystal.rb +1 −1
  33. lib/docs/scrapers/dart.rb +37 −0
  34. lib/docs/scrapers/django.rb +6 −0
  35. lib/docs/scrapers/docker.rb +1 −1
  36. lib/docs/scrapers/electron.rb +1 −1
  37. lib/docs/scrapers/elixir.rb +13 −0
  38. lib/docs/scrapers/express.rb +1 −1
  39. lib/docs/scrapers/fish.rb +1 −1
  40. lib/docs/scrapers/flow.rb +2 −2
  41. lib/docs/scrapers/gnu.rb +1 −1
  42. lib/docs/scrapers/graphite.rb +21 −0
  43. lib/docs/scrapers/grunt.rb +1 −1
  44. lib/docs/scrapers/handlebars.rb +23 −0
  45. lib/docs/scrapers/haxe.rb +1 −1
  46. lib/docs/scrapers/immutable.rb +1 −1
  47. lib/docs/scrapers/influxdata.rb +1 −1
  48. lib/docs/scrapers/jasmine.rb +3 −3
  49. lib/docs/scrapers/jest.rb +2 −2
  50. lib/docs/scrapers/julia.rb +22 −2
  51. lib/docs/scrapers/laravel.rb +14 −1
  52. lib/docs/scrapers/less.rb +1 −1
  53. lib/docs/scrapers/lodash.rb +1 −1
  54. lib/docs/scrapers/marionette.rb +8 −1
  55. lib/docs/scrapers/markdown.rb +1 −1
  56. lib/docs/scrapers/mocha.rb +1 −1
  57. lib/docs/scrapers/mongoose.rb +1 −1
  58. lib/docs/scrapers/nim.rb +1 −1
  59. lib/docs/scrapers/node.rb +3 −3
  60. lib/docs/scrapers/npm.rb +1 −1
  61. lib/docs/scrapers/php.rb +1 −1
  62. lib/docs/scrapers/puppeteer.rb +18 −0
  63. lib/docs/scrapers/pygame.rb +20 −0
  64. lib/docs/scrapers/qt.rb +121 −0
  65. lib/docs/scrapers/redis.rb +1 −1
  66. lib/docs/scrapers/redux.rb +1 −1
  67. lib/docs/scrapers/requirejs.rb +1 −1
  68. lib/docs/scrapers/rust.rb +5 −5
  69. lib/docs/scrapers/typescript.rb +2 −2
  70. lib/docs/scrapers/vagrant.rb +1 −1
  71. lib/docs/scrapers/vulkan.rb +1 −1
  72. lib/docs/scrapers/webpack.rb +1 −1
  73. lib/docs/scrapers/yarn.rb +2 −2
lib/docs/filters/bash/clean_html.rb+74−0
@@ -0,0 +1,74 @@
1+module Docs
2+ class Bash
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Remove the navigation header and footer and the lines underneath and above it
6+ at_css('.header + hr').remove
7+ line_above = at_xpath('//div[@class="header"]/preceding::hr[1]')
8+ line_above.remove unless line_above.nil?
9+ css('.header').remove
10+
11+ # Remove chapter and section numbers from title
12+ title_node = at_css('h1, h2, h3, h4, h5, h6')
13+ title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip
14+ title_node.name = 'h1'
15+
16+ # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
17+ title_node.content = title_node.content[3..-1] if title_node.content.start_with?("D. ")
18+
19+ # Remove columns containing a single space from tables
20+ # In the original reference they are used to add width between two columns
21+ xpath('//td[text()=" " and not(descendant::*)]').remove
22+
23+ # Add id's to additional entry nodes
24+ css('dl > dt > code').each do |node|
25+ # Only take the direct text (i.e. "<div>Hello <span>World</span></div>" becomes "Hello")
26+ node['id'] = node.xpath('text()').to_s.strip
27+ end
28+
29+ # Fix hashes of index entries so they link to the correct hash on the linked page
30+ css('table[class^=index-] td[valign=top] > a').each do |node|
31+ path = node['href'].split('#')[0]
32+ hash = node.content
33+
34+ # Fix the index entries linking to the Special Parameters page
35+ # There are multiple index entries that should link to the same paragraph on that page
36+ # Example: the documentation for "$!" is equal to the documentation for "!"
37+ if path.downcase.include?('special-parameters')
38+ if hash.size > 1 && hash[0] == '$'
39+ hash = hash[1..-1]
40+ end
41+ end
42+
43+ node['href'] = path + '#' + hash
44+ end
45+
46+ # Fix index table letter hashes (the "Jump to" hashes)
47+ css('table[class^=index-] th > a').each do |node|
48+ node['id'] = node['name']
49+ end
50+
51+ # Remove the rows with a horizontal line in them from the index tables
52+ css('td[colspan="4"]').remove
53+
54+ # Remove additional text from menu entry and index entry cells
55+ css('td[valign=top]').each do |node|
56+ link = node.at_css('a')
57+ node.children = link unless link.nil?
58+ end
59+
60+ css('tt', 'code', 'table').remove_attr('class')
61+
62+ css('tt').each do |node|
63+ node.name = 'code'
64+ end
65+
66+ css('pre').each do |node|
67+ node.content = node.content
68+ end
69+
70+ doc
71+ end
72+ end
73+ end
74+end
lib/docs/filters/bash/entries.rb+56−0
@@ -0,0 +1,56 @@
1+module Docs
2+ class Bash
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ name = at_css('hr + a + *').content.gsub(/(\d+\.?)+/, '')
6+
7+ # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
8+ name = name[3..-1] if name.start_with?('D. ')
9+
10+ name
11+ end
12+
13+ def get_type
14+ return 'Manual: Appendices' if name.start_with?('Appendix')
15+ return 'Manual: Indexes' if at_css('a[rel=up]').content.include?("Index")
16+ "Manual"
17+ end
18+
19+ def additional_entries
20+ entry_type = {
21+ "Function Index" => "Functions",
22+ "Index of Shell Builtin Commands" => "Builtin Commands",
23+ "Index of Shell Reserved Words" => "Reserved Words",
24+ "Parameter and Variable Index" => "Parameters and Variables"
25+ }[name]
26+
27+ # Only extract additional entries from certain index pages
28+ return [] if entry_type.nil?
29+
30+ entries = []
31+
32+ css('table[class^=index-] td[valign=top] > a').each_slice(2) do |entry_node, section_node|
33+ entry_name = entry_node.content
34+
35+ page = section_node['href'].split('#')[0]
36+ hash = entry_name
37+
38+ # The Special Parameters page has multiple additional entries which should link to the same paragraph
39+ # Example: the documentation for "$!" is equal to the documentation for "!"
40+ if page == 'special-parameters'
41+ if hash.size > 1 && hash[0] == '$'
42+ hash = hash[1..-1]
43+ end
44+ end
45+
46+ # Construct path to the page which the index links to
47+ entry_path = '/html_node/' + page + '#' + hash
48+
49+ entries << [entry_name, entry_path, entry_type]
50+ end
51+
52+ entries
53+ end
54+ end
55+ end
56+end
lib/docs/filters/dart/clean_html.rb+66−0
@@ -0,0 +1,66 @@
1+module Docs
2+ class Dart
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Move the title into the main content node in the v1 docs
6+ title = at_css('h1.title')
7+ if title
8+ name = title.children.last.content.strip
9+ kind = title.at_css('.kind').content
10+ at_css('.main-content').prepend_child("<h1>#{name} #{kind}</h1>")
11+ end
12+
13+ # Add a title to the homepage of the v2 docs
14+ if subpath == 'index.html' && at_css('.main-content > h1').nil?
15+ at_css('.main-content').prepend_child('<h1>Dart SDK</h1>')
16+ end
17+
18+ # Add the library to the main content (it is not always visible in the menu entry)
19+ breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
20+ if breadcrumbs.length > 1
21+ library = breadcrumbs[1].content
22+
23+ # Generate the link to the homepage of the library
24+ with_hypens = library.gsub(/:/, '-')
25+ location = "#{'../' * subpath.count('/')}#{with_hypens}/#{with_hypens}-library"
26+ link = "<a href=\"#{location}\" class=\"_links-link\">#{library}</span>"
27+
28+ # Add the link to the main title, just like how the "Homepage" and "Source code" links appear
29+ at_css('.main-content').prepend_child("<p class=\"_links\">#{link}</p>")
30+ end
31+
32+ # Extract the actual content
33+ # We can't use options[:container] here because the entries filter uses the breadcrumbs node
34+ @doc = at_css('.main-content')
35+
36+ # Move the features (i.e. "read-only, inherited") into the blue header
37+ css('.features').each do |node|
38+ header = node.xpath('parent::dd/preceding::dt').last
39+ header.add_child node unless header.nil?
40+ end
41+
42+ css('section').each do |node|
43+ if node['id'] && node.first_element_child
44+ node.first_element_child['id'] ||= node['id']
45+ end
46+
47+ node.before(node.children).remove
48+ end
49+
50+ css('span').each do |node|
51+ node.before(node.children).remove
52+ end
53+
54+ # Make code blocks detectable by Prism
55+ css('pre').each do |node|
56+ node['data-language'] = 'dart'
57+ node.content = node.content
58+ end
59+
60+ css('.properties', '.property', '.callables', '.callable').remove_attr('class')
61+
62+ doc
63+ end
64+ end
65+ end
66+end
lib/docs/filters/dart/entries.rb+42−0
@@ -0,0 +1,42 @@
1+module Docs
2+ class Dart
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ title = at_css('h1.title')
6+ if title # v1
7+ name = title.element_children.last.content.strip
8+ kind = title.at_css('.kind').content
9+ else # v2
10+ title = at_css('.main-content > h1')
11+ name = title.content[/(.*)( )/, 1].split(' top-level')[0]
12+ kind = title.content[/(.*)( )(.+)/, 3]
13+ end
14+
15+ breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
16+ first_part = ''
17+
18+ if breadcrumbs.length == 2 && !kind.include?('class')
19+ first_part = breadcrumbs[1].content
20+ elsif breadcrumbs.length == 3
21+ first_part = breadcrumbs[2].content
22+ end
23+
24+ separator = ''
25+
26+ unless first_part.empty?
27+ if kind.include?('class')
28+ separator = ':'
29+ else
30+ separator = '.'
31+ end
32+ end
33+
34+ "#{first_part}#{separator}#{name}"
35+ end
36+
37+ def get_type
38+ at_css('.breadcrumbs > li:nth-child(2)').content.split(' ')[0]
39+ end
40+ end
41+ end
42+end
lib/docs/filters/dom/entries.rb+3−0
@@ -26,6 +26,7 @@ module Docs · 25 unmodified lines
2626 'Geometry' => 'Geometry',
2727 'High Resolution Time' => 'Performance',
2828 'Intersection' => 'Intersection Observer',
29+ 'Media Capabilities' => 'Media',
2930 'Media Capture' => 'Media',
3031 'Media Session' => 'Media',
3132 'Media Source' => 'Media',
@@ -99,6 +100,7 @@ module Docs · 67 unmodified lines
99100 'MediaSession' => 'Media Session',
100101 'MediaTrack' => 'Media Streams',
101102 'Message' => 'Channel Messaging',
103+ 'Mutation' => 'DOM',
102104 'NamedNode' => 'Nodes',
103105 'Node' => 'Nodes',
104106 'Notification' => 'Notification',
@@ -116,6 +118,7 @@ module Docs · 11 unmodified lines
116118 'Shadow' => 'Shadow DOM',
117119 'StaticRange' => 'Range',
118120 'Streams' => 'Media Streams',
121+ 'StyleProperty' => 'CSS',
119122 'StyleSheet' => 'CSS',
120123 'Stylesheet' => 'CSS',
121124 'SVG' => 'SVG',
lib/docs/filters/elixir/clean_html.rb+1−0
@@ -59,6 +59,7 @@ module Docs · 58 unmodified lines
5959
6060 css('pre').each do |node|
6161 node['data-language'] = 'elixir'
62+ node.content = node.content
6263 end
6364 end
6465 end
lib/docs/filters/express/clean_html.rb+5−0
@@ -42,6 +42,11 @@ module Docs · 41 unmodified lines
4242 node.parent.content = node.parent.content
4343 end
4444
45+ # Fix links to the method reference
46+ css('a').each do |node|
47+ node['href'] = node['href'].sub('4x/api', 'index')
48+ end
49+
4550 doc
4651 end
4752 end
lib/docs/filters/graphite/clean_html.rb+27−0
@@ -0,0 +1,27 @@
1+module Docs
2+ class Graphite
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Remove the paragraph icon after all headers
6+ css('.headerlink').remove
7+
8+ css('dl.function > dt').each do |node|
9+ node.content = node.content
10+ end
11+
12+ css('.section').each do |node|
13+ node.before(node.children).remove
14+ end
15+
16+ css('div[class*="highlight-"]').each do |node|
17+ node.content = node.content.strip
18+ node.name = 'pre'
19+ node['data-language'] = node['class'][/highlight\-(\w+)/, 1]
20+ node.remove_attribute('class')
21+ end
22+
23+ doc
24+ end
25+ end
26+ end
27+end
lib/docs/filters/graphite/entries.rb+46−0
@@ -0,0 +1,46 @@
1+module Docs
2+ class Graphite
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ at_css('h1').children[0].to_s
6+ end
7+
8+ def get_type
9+ get_name
10+ end
11+
12+ def additional_entries
13+ entries = []
14+
15+ # Sections
16+ css('.section > .section').each do |node|
17+ title = node.at_css('h2, h3')
18+
19+ next if title.nil?
20+
21+ # Move the id attribute to the title
22+ # If this is excluded, the complete section will be highlighted in yellow when someone navigates to it
23+ title['id'] = node['id']
24+ node.remove_attribute('id')
25+
26+ parent_title_selector = "parent::div[@class='section']/preceding::#{title.name == 'h2' ? 'h1' : 'h2'}"
27+
28+ entries << [
29+ title.children[0].to_s,
30+ title['id'],
31+ title.xpath(parent_title_selector).last.children[0].to_s
32+ ]
33+ end
34+
35+ # Functions
36+ css('dl.function > dt').each do |node|
37+ name = node.at_css('.descname').content
38+ name << '()'
39+ entries << [name, node['id'], 'Functions']
40+ end
41+
42+ entries
43+ end
44+ end
45+ end
46+end
lib/docs/filters/handlebars/clean_html.rb+44−0
@@ -0,0 +1,44 @@
1+module Docs
2+ class Handlebars
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Remove the t-shirt shop advertisement
6+ css('#callout').remove
7+
8+ # The title filter is used to add titles to pages without one, remove original headers
9+ css('h1').remove
10+
11+ # Remove the link to the issue tracker
12+ css('.issue-tracker').remove
13+
14+ css('pre').each do |node|
15+ # Remove nested nodes inside pre tags
16+ node.content = node.content
17+
18+ # Add syntax highlighting
19+ node['data-language'] = 'html'
20+ end
21+
22+ # Transform 'Learn More' links to headers in the "Getting Started" part of the homepage
23+ # If this step is skipped, that section looks cluttered with 4 sub-sections without any dividers
24+ css('#getting-started + .contents a.more-info').each do |node|
25+ clone = node.clone
26+
27+ # Move it to the top of the sub-section
28+ node.parent.prepend_child(clone)
29+
30+ # Turn it into a header
31+ clone.name = 'h3'
32+
33+ # Remove the "Learn More: " part
34+ clone.content = clone.content[12..-1]
35+ end
36+
37+ # Remove class attributes from div elements to reduce file size
38+ css('div').remove_attr('class')
39+
40+ doc
41+ end
42+ end
43+ end
44+end
lib/docs/filters/handlebars/entries.rb+19−0
@@ -0,0 +1,19 @@
1+module Docs
2+ class Handlebars
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ subpath[0..-6].titleize
6+ end
7+
8+ def get_type
9+ name
10+ end
11+
12+ def additional_entries
13+ css('h2, h3').to_a.map do |node|
14+ [node.content.strip, node['id'], root_page? ? 'Manual' : nil]
15+ end
16+ end
17+ end
18+ end
19+end
lib/docs/filters/puppeteer/clean_html.rb+24−0
@@ -0,0 +1,24 @@
1+module Docs
2+ class Puppeteer
3+ class CleanHtmlFilter < Filter
4+ def call
5+ at_css('h1').content = 'Puppeteer Documentation'
6+
7+ # None of the elements to remove have classes, so the order of the remove calls is trivial
8+
9+ # Remove links to previous versions of the reference
10+ at_css('h1 + ul').remove
11+
12+ # Remove table of contents
13+ at_css('h1 + h5').remove
14+ at_css('h1 + ul').remove
15+
16+ # Make headers bigger by transforming them into a bigger variant
17+ css('h3').each { |node| node.name = 'h2' }
18+ css('h4').each { |node| node.name = 'h3' }
19+
20+ doc
21+ end
22+ end
23+ end
24+end
lib/docs/filters/puppeteer/entries.rb+41−0
@@ -0,0 +1,41 @@
1+module Docs
2+ class Puppeteer
3+ class EntriesFilter < Docs::EntriesFilter
4+ # The entire reference is one big page, so get_name and get_type are not necessary
5+
6+ def additional_entries
7+ entries = []
8+
9+ css('h3').each do |node|
10+ name = node.content.split(': ').last
11+
12+ # Find all sub-items (all h4's between the current h3 and the next)
13+ current = node.next
14+ while !current.nil? && current.name != 'h3'
15+ if current.name == 'h4'
16+ current_name = current.content
17+
18+ # Prepend events with the class name
19+ if current_name.start_with?('event: ')
20+ current_name = "#{name} event: #{current_name[/'(.*)'/, 1]}"
21+ end
22+
23+ # Remove arguments from functions
24+ if current_name.include?('(')
25+ current_name = current_name.split('(')[0] + '()'
26+ end
27+
28+ entries << [current_name, current['id'], name]
29+ end
30+
31+ current = current.next
32+ end
33+
34+ entries << [name, node['id'], name]
35+ end
36+
37+ entries
38+ end
39+ end
40+ end
41+end
lib/docs/filters/pygame/clean_html.rb+102−0
@@ -0,0 +1,102 @@
1+module Docs
2+ class Pygame
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css '.body'
6+
7+ if root_page?
8+ # remove unneeded stuff
9+ at_css('.modindex-jumpbox').remove
10+ css('[role="navigation"],.pcap, .cap, .footer').remove
11+ # table -> list
12+ list = at_css('table')
13+ list.replace(list.children)
14+ list.name = 'ul'
15+ css('tr').each do |row|
16+ row.name = 'li'
17+ row.remove_attribute('class')
18+ end
19+ at_css('h1').content = 'Pygame'
20+ return doc
21+ end
22+
23+ # remove unwanted stuff
24+ # .headerlink => ¶ after links
25+ # .toc => table of content
26+ # .tooltip-content => tooltips after links to functions
27+ css('table.toc.docutils, .headerlink, .tooltip-content').remove
28+
29+ # Remove wrapper .section
30+ section = at_css('.section')
31+ definition = at_css('.definition')
32+ definition['id'] = section['id']
33+ section.replace(section.children)
34+
35+ # Format code for it be highlighted
36+ css('.highlight-default.notranslate').each do |node|
37+ pre = node.at_css('pre')
38+ node.replace(pre)
39+ # gets rid of the already existing syntax highlighting
40+ pre.content = pre.content
41+ pre['class'] = 'language-python'
42+ pre['data-language'] = "python"
43+ end
44+
45+ # change descriptions of functions/attributes to blockquote
46+ css('.line-block').each do |node|
47+ node.name = 'blockquote'
48+ end
49+
50+ # change functions
51+ css('.definition').each do |d|
52+
53+ # the header is the function/attribute name. It might look something like
54+ # this:
55+ # pygame.image.load()
56+ # It'll end up being something like this:
57+ # pygame.image.load(filename) -> Surface
58+ # pygame.image.load(fileobj, namehint="") -> Surface
59+
60+ header = d.at_css('dt.title')
61+ if d['class'].include?('class') or d['class'].include?('module')
62+ header.name = 'h1'
63+ @section = header.content.strip
64+ else
65+ header.name = 'h3'
66+ end
67+ # save the original header
68+ initial_header = header.content.strip
69+ # save the real name for the entries
70+ header['data-name'] = initial_header
71+ # empty the header
72+ if header.name == 'h3'
73+ header.inner_html = ''
74+ end
75+ # to replace it with the signatures
76+ next_el = header.next_element
77+ signatures = next_el.css('.signature')
78+ signatures.each do |sig|
79+ sig.name = 'code'
80+ if header.name == 'h3'
81+ sig.parent = header
82+ # the signature don't contain pygame.module. I think it's better
83+ # to display them, as it avoids confusion with methods (have a
84+ # look at the pygame.Rect page)
85+ if initial_header.start_with?(@section)
86+ sig.content = @section + '.' + sig.text
87+ end
88+ # seperate the signatures on different lines.
89+ header.add_child "<br>"
90+ end
91+ end
92+ end
93+
94+ css('> dl', '> dl > dd', 'h1 code').each do |node|
95+ node.before(node.children).remove
96+ end
97+
98+ doc
99+ end
100+ end
101+ end
102+end
lib/docs/filters/pygame/entries.rb+29−0
@@ -0,0 +1,29 @@
1+module Docs
2+ class Pygame
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ at_css('h1').content.remove('pygame.')
6+ end
7+
8+ def get_type
9+ at_css('h1').content
10+ end
11+
12+ def additional_entries
13+ return [] if root_page?
14+
15+ css('h1, h2, h3').each_with_object [] do |node, entries|
16+ name = node['id'] || node['data-name']
17+
18+ if node.parent['class'].include?('function') or node.parent['class'].include?('method')
19+ name << '()'
20+ end
21+
22+ name.remove!('pygame.')
23+
24+ entries << [name, node['id']] unless name == self.name
25+ end
26+ end
27+ end
28+ end
29+end
lib/docs/filters/python/clean_html.rb+5−3
@@ -15,15 +15,17 @@ module Docs · 14 unmodified lines
1515
1616 def other
1717 css('h1').each do |node|
18− node.content = node.content.sub!(/\A[\d\.]+/) do |str|
18+ node.content = node.content.sub(/\A[\d\.]+/) do |str|
1919 rgx = /\A#{str}/
2020 @levelRegexp = @levelRegexp ? Regexp.union(@levelRegexp, rgx) : rgx
2121 ''
2222 end
2323 end
2424
25− css('h2', 'h3', 'h4').each do |node|
26− node.inner_html = node.inner_html.remove @levelRegexp
25+ unless @levelRegexp.nil?
26+ css('h2', 'h3', 'h4').each do |node|
27+ node.inner_html = node.inner_html.remove @levelRegexp
28+ end
2729 end
2830 end
2931 end
lib/docs/filters/python/entries_v3.rb+12−10
@@ -2,16 +2,18 @@ module Docs · 1 unmodified line
22 class Python
33 class EntriesV3Filter < Docs::EntriesFilter
44 REPLACE_TYPES = {
5− 'Cryptographic' => 'Cryptography',
6− 'Custom Interpreters' => 'Interpreters',
7− 'Data Compression & Archiving' => 'Data Compression',
8− 'Generic Operating System' => 'Operating System',
9− 'Graphical User Interfaces with Tk' => 'Tk',
10− 'Internet Data Handling' => 'Internet Data',
11− 'Internet Protocols & Support' => 'Internet',
12− 'Interprocess Communication & Networking' => 'Networking',
13− 'Program Frameworks' => 'Frameworks',
14− 'Structured Markup Processing Tools' => 'Structured Markup' }
5+ 'contextvars — Context Variables' => 'Context Variables',
6+ 'Cryptographic' => 'Cryptography',
7+ 'Custom Interpreters' => 'Interpreters',
8+ 'Data Compression & Archiving' => 'Data Compression',
9+ 'email — An email & MIME handling package' => 'Email',
10+ 'Generic Operating System' => 'Operating System',
11+ 'Graphical User Interfaces with Tk' => 'Tk',
12+ 'Internet Data Handling' => 'Internet Data',
13+ 'Internet Protocols & Support' => 'Internet',
14+ 'Interprocess Communication & Networking' => 'Networking',
15+ 'Program Frameworks' => 'Frameworks',
16+ 'Structured Markup Processing Tools' => 'Structured Markup' }
1517
1618 def get_name
1719 name = at_css('h1').content
lib/docs/filters/qt/clean_html.rb+31−0
@@ -0,0 +1,31 @@
1+module Docs
2+ class Qt
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Remove unneeded elements
6+ css('.copy-notice, .navigationbar, .headerNavi, .footerNavi, .sidebar, .toc, #ec_toggle', '.landingicons img', 'br').remove
7+
8+ # QML property/method header
9+ css('.qmlproto').each do |node|
10+ id = node.at_css('tr')['id']
11+ node.inner_html = node.at_css('td').inner_html
12+ node.name = 'h3'
13+ node['id'] = id
14+ end
15+
16+ css('.main-rounded', '.content', '.line', '.context', '.descr', '.types', '.func', '.table', 'div:not([class])', '.landing', '.col-1', '.heading', '.qmlitem', '.qmldoc', 'div.pre').each do |node|
17+ node.before(node.children).remove
18+ end
19+
20+ css('pre').each do |node|
21+ node.content = node.content
22+ node['data-language'] = 'cpp' if node['class'].include?('cpp')
23+ node['data-language'] = 'qml' if node['class'].include?('qml')
24+ node.remove_attribute('class')
25+ end
26+
27+ doc
28+ end
29+ end
30+ end
31+end
lib/docs/filters/qt/entries.rb+141−0
@@ -0,0 +1,141 @@
1+# frozen_string_literal: true
2+
3+module Docs
4+ class Qt
5+ class EntriesFilter < Docs::EntriesFilter
6+ def get_name
7+ header = at_css('h1.title + .small-subtitle a') || at_css('h1.title') || at_css('.context h2')
8+ name = header.content
9+ name.sub! %r{ Class$}, ' (class)'
10+ name.sub! %r{ QML Type$}, ' (QML type)'
11+ name.sub! %r{ QML Basic Type$}, ' (QML basic type)'
12+
13+ # Add '(class)' to the class pages where the subtitle name is used (e.g. qset-const-iterator.html)
14+ if at_css('h1.title').content.strip.end_with?(' Class') && !name.include?('(class)')
15+ name = "#{name} (class) "
16+ end
17+
18+ name
19+ end
20+
21+ def get_type
22+ breadcrumb = css('#main_title_bar + ul li')
23+ category = if breadcrumb.length < 3
24+ then 'Qt'.dup
25+ else breadcrumb.at(1).content
26+ end
27+
28+ if category == 'Qt'
29+ return 'Qt Platforms' if name.include?(' for ') || name == 'Qt Platform Abstraction'
30+ return 'Qt Quick' if name == 'Qt Quick Test' || name == 'Qt Quick Test Reference Documentation'
31+
32+ alwaysInQt = ['Qt Configure Options', 'Qt Image Formats']
33+ category = name if name.start_with?('Qt ') && !alwaysInQt.include?(name)
34+ end
35+
36+ qtPlatformsTypes = ['Qt Platform Headers', 'Qt Android Extras', 'Qt Mac Extras', 'Qt Windows Extras', 'Qt X11 Extras']
37+ return 'Qt Platforms' if qtPlatformsTypes.include?(category)
38+
39+ category.remove!(' Manual')
40+ category
41+ end
42+
43+ def include_default_entry?
44+ name != 'All Classes' && name != 'All QML Types'
45+ end
46+
47+ def additional_entries
48+ entries = []
49+ titles = []
50+
51+ className = at_css('h1.title').content.strip.remove(' Class')
52+ displayedClassName = className
53+ alternativeClassName = at_css('h1.title + .small-subtitle a')
54+ displayedClassName = alternativeClassName.content if alternativeClassName
55+
56+ # Functions signatures
57+ css('h3.fn').each do |node|
58+ header = node.clone
59+
60+ # Skip typenames
61+ next if header.content.strip.start_with?('typename ')
62+
63+ # Remove leading <a name="">
64+ header.children.css('a[name]').remove
65+
66+ # Remove leading <code> tag (virtual/static/… attributes)
67+ code = header.children.first
68+ code.remove if code.name == 'code'
69+
70+ # Remove leading ‘const’
71+ header.children.first.remove if header.content.strip.start_with?('const ')
72+
73+ # Remove return type
74+ returnType = header.children.first
75+ returnType.remove if returnType['class'] == 'type'
76+
77+ title = header.content.strip
78+
79+ # Remove leading '&'/'*'
80+ title[0] = '' if title[0] == '&' || title[0] == '*'
81+
82+ # Ignore operator overloads
83+ next if title.start_with?('operator')
84+
85+ # Remove function parameters
86+ title.sub! %r{\(.*\)}, '()'
87+
88+ # Remove template generics
89+ title.remove!(%r{^<.*> })
90+
91+ # Remove ‘const’ at the end
92+ title.remove!(%r{ const$})
93+
94+ # Enum/typedef formatting
95+ title.sub! %r{(enum|typedef) (.*)}, '\2 (\1)'
96+
97+ # Remove property type
98+ title = "#{displayedClassName}::#{title}" if title.sub!(%r{ : .*$}, '')
99+
100+ # Replace the class name by the alternative class name if available
101+ title = title.sub(className, displayedClassName) if alternativeClassName
102+
103+ unless titles.include?(title) # Remove duplicates (function overloading)
104+ entries << [title, header['id']]
105+ titles.push title
106+ end
107+ end
108+
109+ # QML properties/functions
110+ qmlTypeName = at_css('h1.title').content.remove(' QML Type', '')
111+ css('.qmlproto').each do |node|
112+ title = node.content.strip
113+ id = node.at_css('tr')['id']
114+
115+ # Remove options
116+ title.remove!(%r{^\[.*\] })
117+
118+ # Remove function parameters
119+ title.sub! %r{\(.*\)}, '()'
120+
121+ # Remove property type
122+ title.remove!(%r{ : .*$})
123+
124+ # Remove return type
125+ title.remove!(%r{.* })
126+
127+ # Remove return type
128+ title.remove!(%r{.* })
129+
130+ title = "#{qmlTypeName}.#{title.strip}"
131+ unless titles.include?(title) # Remove duplicates (function overloading)
132+ entries << [title, id]
133+ titles.push(title)
134+ end
135+ end
136+
137+ entries
138+ end
139+ end
140+ end
141+end
lib/docs/filters/redis/entries.rb+2−1
@@ -12,7 +12,7 @@ module Docs · 11 unmodified lines
1212 when 'HDEL' then 'Hashes'
1313 when 'BLPOP' then 'Lists'
1414 when 'SADD' then 'Sets'
15− when 'ZADD' then 'Sorted Sets'
15+ when 'BZPOPMAX' then 'Sorted Sets'
1616 when 'PSUBSCRIBE' then 'Pub/Sub'
1717 when 'DISCARD' then 'Transactions'
1818 when 'EVAL' then 'Scripting'
@@ -21,6 +21,7 @@ module Docs · 2 unmodified lines
2121 when 'PFADD' then 'HyperLogLog'
2222 when 'CLUSTER ADDSLOTS' then 'Cluster'
2323 when 'GEOADD' then 'Geo'
24+ when 'XADD' then 'Stream'
2425 else 'Miscellaneous'
2526 end
2627 end
lib/docs/filters/rust/clean_html.rb+37−6
@@ -2,10 +2,8 @@ module Docs · 1 unmodified line
22 class Rust
33 class CleanHtmlFilter < Filter
44 def call
5− puts subpath if at_css('#versioninfo')
6−
75 if slug.start_with?('book') || slug.start_with?('reference')
8− @doc = at_css('#content')
6+ @doc = at_css('#content main')
97 elsif slug == 'error-index'
108 css('.error-undescribed').remove
119
@@ -29,12 +27,16 @@ module Docs · 17 unmodified lines
2927
3028 css('.rusttest', '.test-arrow', 'hr').remove
3129
30+ css('.docblock.attributes').each do |node|
31+ node.remove if node.content.include?('#[must_use]')
32+ end
33+
3234 css('a.header').each do |node|
33− node.first_element_child['id'] = node['name']
35+ node.first_element_child['id'] = node['name'] || node['id']
3436 node.before(node.children).remove
3537 end
3638
37− css('.docblock > h1').each { |node| node.name = 'h4' }
39+ css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' }
3840 css('h2.section-header').each { |node| node.name = 'h3' }
3941 css('h1.section-header').each { |node| node.name = 'h2' }
4042
@@ -44,7 +46,7 @@ module Docs · 3 unmodified lines
4446 end
4547 end
4648
47− css('> .impl-items', '> .docblock', 'pre > pre').each do |node|
49+ css('> .impl-items', '> .docblock', 'pre > pre', '.tooltiptext', '.tooltip').each do |node|
4850 node.before(node.children).remove
4951 end
5052
@@ -62,6 +64,35 @@ module Docs · 11 unmodified lines
6264 node['data-language'] = 'rust' if node['class'] && node['class'].include?('rust')
6365 end
6466
67+ doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'
68+ at_css('h1').content = 'Rust Documentation' if root_page?
69+
70+ css('.table-display').each do |node|
71+ node.css('td').each do |td|
72+ node.before(td.children)
73+ end
74+ node.remove
75+ end
76+
77+ css('h2 .important-traits', 'h3 .important-traits', 'h4 .important-traits').each do |node|
78+ content = node.at_css('.content.hidden .content')
79+ node.at_css('.content.hidden').replace(content) if content
80+ node.parent.after(node)
81+ end
82+
83+ css('code.content').each do |node|
84+ node.name = 'pre'
85+ node.css('.fmt-newline').each do |line|
86+ line.inner_html = line.inner_html + "\n"
87+ end
88+ node.inner_html = node.inner_html.gsub('<br>', "\n")
89+ node.content = node.content
90+ end
91+
92+ css('.since + .srclink').each do |node|
93+ node.previous_element.before(node)
94+ end
95+
6596 doc
6697 end
6798 end
lib/docs/filters/rust/entries.rb+8−5
@@ -42,11 +42,14 @@ module Docs · 41 unmodified lines
4242 entries << [node.content, node['id']] unless node.content.include?('Note:')
4343 end
4444 else
45− css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node|
46− name = node.at_css('.fnname').content
47− name.prepend "#{self.name}::"
48− [name, node['id']]
49− end
45+ css('.method')
46+ .select {|node| !node.at_css('.fnname').nil?}
47+ .map {|node|
48+ name = node.at_css('.fnname').content
49+ name.prepend "#{self.name}::"
50+ [name, node['id']]
51+ }
52+ .uniq {|item| item[0]}
5053 end
5154 end
5255 end
lib/docs/filters/typescript/entries.rb+1−0
@@ -9,6 +9,7 @@ module Docs · 8 unmodified lines
99
1010 def get_type
1111 return 'Declaration Files' if subpath.include?('declaration-files')
12+ return 'Project Configuration' if slug == 'handbook/configuring-watch'
1213 type = at_css('#main-nav a.active').ancestors('.panel').first.at_css('> a').content
1314 type = name if type == 'Handbook'
1415 type
lib/docs/scrapers/apache.rb+1−1
@@ -3,7 +3,7 @@ module Docs · 2 unmodified lines
33 self.name = 'Apache HTTP Server'
44 self.slug = 'apache_http_server'
55 self.type = 'apache'
6− self.release = '2.4.33'
6+ self.release = '2.4.34'
77 self.base_url = 'https://httpd.apache.org/docs/2.4/en/'
88 self.links = {
99 home: 'https://httpd.apache.org/'
lib/docs/scrapers/apache_pig.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class ApachePig < UrlScraper
33 self.name = 'Apache Pig'
44 self.slug = 'apache_pig'
5− self.type = 'apache_pig'
5+ self.type = 'simple'
66 self.links = {
77 home: 'https://pig.apache.org/'
88 }
lib/docs/scrapers/bash.rb+21−0
@@ -0,0 +1,21 @@
1+module Docs
2+ class Bash < UrlScraper
3+ self.type = 'bash'
4+ self.release = '4.4'
5+ self.base_url = 'https://www.gnu.org/software/bash/manual'
6+ self.root_path = '/html_node/index.html'
7+ self.links = {
8+ home: 'https://www.gnu.org/software/bash/',
9+ code: 'http://git.savannah.gnu.org/cgit/bash.git'
10+ }
11+
12+ html_filters.push 'bash/entries', 'bash/clean_html'
13+
14+ options[:only_patterns] = [/\/html_node\//]
15+
16+ options[:attribution] = <<-HTML
17+ Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>
18+ Licensed under the GNU Free Documentation License.
19+ HTML
20+ end
21+end
lib/docs/scrapers/bootstrap.rb+1−1
@@ -16,7 +16,7 @@ module Docs · 15 unmodified lines
1616 HTML
1717
1818 version '4' do
19− self.release = '4.1.1'
19+ self.release = '4.1.3'
2020 self.base_url = 'https://getbootstrap.com/docs/4.1/'
2121 self.root_path = 'getting-started/introduction/'
2222
lib/docs/scrapers/bower.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Bower < UrlScraper
33 self.name = 'Bower'
4− self.type = 'bower'
4+ self.type = 'simple'
55 self.release = '1.8.4'
66 self.base_url = 'https://bower.io/docs/'
77 self.root_path = 'api'
lib/docs/scrapers/chai.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Chai < UrlScraper
33 self.name = 'Chai'
4− self.type = 'chai'
4+ self.type = 'simple'
55 self.release = '4.1.0'
66 self.base_url = 'http://chaijs.com'
77 self.root_path = '/api/'
lib/docs/scrapers/cmake.rb+12−2
@@ -16,12 +16,22 @@ module Docs · 15 unmodified lines
1616 options[:skip_patterns] = [/\Agenerator/, /\Ainclude/, /\Arelease/]
1717
1818 options[:attribution] = <<-HTML
19− &copy; 2000&ndash;2017 Kitware, Inc. and Contributors<br>
19+ &copy; 2000&ndash;2018 Kitware, Inc. and Contributors<br>
2020 Licensed under the BSD 3-clause License.
2121 HTML
2222
23+ version '3.12' do
24+ self.release = '3.12.1'
25+ self.base_url = 'https://cmake.org/cmake/help/v3.12/'
26+ end
27+
28+ version '3.11' do
29+ self.release = '3.11.4'
30+ self.base_url = 'https://cmake.org/cmake/help/v3.11/'
31+ end
32+
2333 version '3.10' do
24− self.release = '3.10.1'
34+ self.release = '3.10.3'
2535 self.base_url = 'https://cmake.org/cmake/help/v3.10/'
2636 end
2737
lib/docs/scrapers/codeceptjs.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Codeceptjs < UrlScraper
33 self.name = 'CodeceptJS'
4− self.type = 'codeceptjs'
4+ self.type = 'simple'
55 self.root_path = 'index.html'
66 self.release = '1.3.1'
77 self.base_url = 'https://codecept.io/'
lib/docs/scrapers/crystal.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Crystal < UrlScraper
33 self.type = 'crystal'
4− self.release = '0.25.1'
4+ self.release = '0.26.0'
55 self.base_url = 'https://crystal-lang.org/'
66 self.root_path = "api/#{release}/index.html"
77 self.initial_paths = %w(docs/index.html)
lib/docs/scrapers/dart.rb+37−0
@@ -0,0 +1,37 @@
1+module Docs
2+ class Dart < FileScraper
3+ self.type = 'dart'
4+ self.root_path = 'index.html'
5+ self.links = {
6+ home: 'https://www.dartlang.org/',
7+ code: 'https://github.com/dart-lang/sdk'
8+ }
9+
10+ html_filters.push 'dart/entries', 'dart/clean_html'
11+
12+ options[:fix_urls] = ->(url) do
13+ # localhost/dart-web_audio/..dart-io/dart-io-library.html > localhost/dart-io/dart-io-library.html
14+ url.remove!(/[^\/]+\/\.\./)
15+ url
16+ end
17+
18+ options[:attribution] = <<-HTML
19+ &copy; 2012 the Dart project authors<br>
20+ Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
21+ HTML
22+
23+ # Download the documentation from https://www.dartlang.org/tools/sdk/archive
24+
25+ version '2' do
26+ self.release = '2.0.0'
27+ self.dir = '/Users/Thibaut/DevDocs/Docs/Dart2'
28+ self.base_url = "https://api.dartlang.org/stable/#{release}/"
29+ end
30+
31+ version '1' do
32+ self.release = '1.24.3'
33+ self.dir = '/Users/Thibaut/DevDocs/Docs/Dart1'
34+ self.base_url = "https://api.dartlang.org/stable/#{release}/"
35+ end
36+ end
37+end
lib/docs/scrapers/django.rb+6−0
@@ -34,6 +34,12 @@ module Docs · 33 unmodified lines
3434 Licensed under the BSD License.
3535 HTML
3636
37+ version '2.1' do
38+ self.release = '2.1.0'
39+ self.dir = '/Users/Thibaut/DevDocs/Docs/Django21'
40+ self.base_url = 'https://docs.djangoproject.com/en/2.1/'
41+ end
42+
3743 version '2.0' do
3844 self.release = '2.0.7'
3945 self.dir = '/Users/Thibaut/DevDocs/Docs/Django20'
lib/docs/scrapers/docker.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Docker < UrlScraper
3− self.type = 'docker'
3+ self.type = 'simple'
44 self.links = {
55 home: 'https://docker.com/',
66 code: 'https://github.com/docker/docker'
lib/docs/scrapers/electron.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Electron < UrlScraper
3− self.type = 'electron'
3+ self.type = 'simple'
44 self.base_url = 'https://electronjs.org/docs'
55 self.release = '2.0.2'
66 self.links = {
lib/docs/scrapers/elixir.rb+13−0
@@ -33,6 +33,19 @@ module Docs · 32 unmodified lines
3333 "https://elixir-lang.org/getting-started/introduction.html" ]
3434 end
3535
36+ version '1.7' do
37+ self.release = '1.7.3'
38+ self.base_urls = [
39+ "https://hexdocs.pm/elixir/#{release}/",
40+ "https://hexdocs.pm/eex/#{release}/",
41+ "https://hexdocs.pm/ex_unit/#{release}/",
42+ "https://hexdocs.pm/iex/#{release}/",
43+ "https://hexdocs.pm/logger/#{release}/",
44+ "https://hexdocs.pm/mix/#{release}/",
45+ 'https://elixir-lang.org/getting-started/'
46+ ]
47+ end
48+
3649 version '1.6' do
3750 self.release = '1.6.5'
3851 self.base_urls = [
lib/docs/scrapers/express.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Express < UrlScraper
33 self.name = 'Express'
44 self.type = 'express'
5− self.release = '4.16.1'
5+ self.release = '4.16.3'
66 self.base_url = 'http://expressjs.com/en/'
77 self.root_path = '4x/api.html'
88 self.initial_paths = %w(
lib/docs/scrapers/fish.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Fish < UrlScraper
33 self.name = 'Fish'
4− self.type = 'fish'
4+ self.type = 'simple'
55 self.root_path = 'index.html'
66 self.links = {
77 home: 'https://fishshell.com/',
lib/docs/scrapers/flow.rb+2−2
@@ -1,7 +1,7 @@
11 module Docs
22 class Flow < UrlScraper
3− self.type = 'flow'
4− self.release = '0.75.0'
3+ self.type = 'simple'
4+ self.release = '0.79.1'
55 self.base_url = 'https://flow.org/en/docs/'
66 self.links = {
77 home: 'https://flow.org/',
lib/docs/scrapers/gnu.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Gnu < FileScraper
3− self.type = 'gnu'
3+ self.type = 'simple'
44 self.root_path = 'index.html'
55 self.abstract = 'true'
66
lib/docs/scrapers/graphite.rb+21−0
@@ -0,0 +1,21 @@
1+module Docs
2+ class Graphite < UrlScraper
3+ self.type = 'graphite'
4+ self.release = '1.1.3'
5+ self.base_url = 'https://graphite.readthedocs.io/en/latest/'
6+ self.links = {
7+ code: 'https://github.com/graphite-project/graphite-web'
8+ }
9+
10+ html_filters.push 'graphite/entries', 'graphite/clean_html'
11+
12+ options[:container] = '.document > div'
13+ options[:skip] = %w(releases.html who-is-using.html composer.html search.html py-modindex.html genindex.html)
14+
15+ options[:attribution] = <<-HTML
16+ &copy; 2008&ndash;2012 Chris Davis<br>
17+ &copy; 2011&ndash;2016 The Graphite Project<br>
18+ Licensed under the Apache License, Version 2.0.
19+ HTML
20+ end
21+end
lib/docs/scrapers/grunt.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Grunt < UrlScraper
33 self.name = 'Grunt'
4− self.type = 'grunt'
4+ self.type = 'simple'
55 self.release = '1.0.1'
66 self.base_url = 'https://gruntjs.com/'
77 self.root_path = 'getting-started'
lib/docs/scrapers/handlebars.rb+23−0
@@ -0,0 +1,23 @@
1+module Docs
2+ class Handlebars < UrlScraper
3+ self.name = 'Handlebars.js'
4+ self.slug = 'handlebars'
5+ self.type = 'simple'
6+ self.release = '4.0.12'
7+ self.base_url = 'https://handlebarsjs.com/'
8+ self.links = {
9+ home: 'https://handlebarsjs.com/',
10+ code: 'https://github.com/wycats/handlebars.js/'
11+ }
12+
13+ html_filters.push 'handlebars/entries', 'handlebars/clean_html', 'title'
14+
15+ options[:container] = '#contents'
16+ options[:root_title] = 'Handlebars.js'
17+
18+ options[:attribution] = <<-HTML
19+ &copy; 2011&ndash;2017 by Yehuda Katz<br>
20+ Licensed under the MIT License.
21+ HTML
22+ end
23+end
lib/docs/scrapers/haxe.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Haxe < UrlScraper
33 self.name = 'Haxe'
4− self.type = 'haxe'
4+ self.type = 'simple'
55 self.release = '3.4.7'
66 self.base_url = 'https://api.haxe.org/'
77
lib/docs/scrapers/immutable.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Immutable < UrlScraper
33 self.name = 'Immutable.js'
44 self.slug = 'immutable'
5− self.type = 'immutable'
5+ self.type = 'simple'
66 self.release = '3.8.1'
77 self.base_url = 'https://facebook.github.io/immutable-js/docs/'
88 self.links = {
lib/docs/scrapers/influxdata.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Influxdata < UrlScraper
33 self.name = 'InfluxData'
4− self.type = 'influxdata'
4+ self.type = 'simple'
55 self.release = '1.3'
66 self.base_url = 'https://docs.influxdata.com/'
77 self.links = {
lib/docs/scrapers/jasmine.rb+3−3
@@ -1,8 +1,8 @@
11 module Docs
22 class Jasmine < UrlScraper
3− self.type = 'jasmine'
4− self.release = '3.1.0'
5− self.base_url = 'https://jasmine.github.io/api/3.0/'
3+ self.type = 'simple'
4+ self.release = '3.2.1'
5+ self.base_url = 'https://jasmine.github.io/api/3.2/'
66 self.root_path = 'index.html'
77 self.links = {
88 home: 'https://jasmine.github.io/',
lib/docs/scrapers/jest.rb+2−2
@@ -1,7 +1,7 @@
11 module Docs
22 class Jest < UrlScraper
3− self.type = 'jest'
4− self.release = '23.3.0'
3+ self.type = 'simple'
4+ self.release = '23.5.0'
55 self.base_url = 'https://jestjs.io/docs/en/'
66 self.root_path = 'getting-started'
77 self.links = {
lib/docs/scrapers/julia.rb+22−2
@@ -12,9 +12,29 @@ module Docs · 11 unmodified lines
1212 Licensed under the MIT License.
1313 HTML
1414
15+ version '1.0' do
16+ self.release = '1.0.0'
17+ self.base_url = "https://docs.julialang.org/en/v#{release}/"
18+ self.type = 'julia'
19+
20+ html_filters.push 'julia/entries', 'julia/clean_html'
21+
22+ options[:container] = '#docs'
23+ end
24+
25+ version '0.7' do
26+ self.release = '0.7.0'
27+ self.base_url = "https://docs.julialang.org/en/v#{release}/"
28+ self.type = 'julia'
29+
30+ html_filters.push 'julia/entries', 'julia/clean_html'
31+
32+ options[:container] = '#docs'
33+ end
34+
1535 version '0.6' do
1636 self.release = '0.6.2'
17− self.base_url = 'https://docs.julialang.org/en/release-0.6/'
37+ self.base_url = "https://docs.julialang.org/en/v#{release}/"
1838 self.type = 'julia'
1939
2040 html_filters.push 'julia/entries', 'julia/clean_html'
@@ -24,7 +44,7 @@ module Docs · 3 unmodified lines
2444
2545 version '0.5' do
2646 self.release = '0.5.2'
27− self.base_url = 'https://docs.julialang.org/en/release-0.5/'
47+ self.base_url = "https://docs.julialang.org/en/v#{release}/"
2848 self.type = 'sphinx_simple'
2949
3050 html_filters.push 'julia/entries_sphinx', 'julia/clean_html_sphinx', 'sphinx/clean_html'
lib/docs/scrapers/laravel.rb+14−1
@@ -29,8 +29,21 @@ module Docs · 28 unmodified lines
2929 Laravel is a trademark of Taylor Otwell.
3030 HTML
3131
32+ version '5.7' do
33+ self.release = '5.7.7'
34+ self.root_path = '/api/5.7/index.html'
35+ self.initial_paths = %w(/docs/5.7/installation /api/5.7/classes.html)
36+
37+ options[:only_patterns] = [%r{\A/api/5\.7/}, %r{\A/docs/5\.7/}]
38+
39+ options[:fix_urls] = ->(url) do
40+ url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.7/"
41+ url
42+ end
43+ end
44+
3245 version '5.6' do
33− self.release = '5.6.12'
46+ self.release = '5.6.33'
3447 self.root_path = '/api/5.6/index.html'
3548 self.initial_paths = %w(/docs/5.6/installation /api/5.6/classes.html)
3649
lib/docs/scrapers/less.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Less < UrlScraper
3− self.type = 'less'
3+ self.type = 'simple'
44 self.release = '2.7.2'
55 self.base_url = 'http://lesscss.org'
66 self.root_path = '/features'
lib/docs/scrapers/lodash.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Lodash < UrlScraper
33 self.name = 'lodash'
44 self.slug = 'lodash'
5− self.type = 'lodash'
5+ self.type = 'simple'
66 self.links = {
77 home: 'https://lodash.com/',
88 code: 'https://github.com/lodash/lodash/'
lib/docs/scrapers/marionette.rb+8−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Marionette < UrlScraper
33 self.name = 'Marionette.js'
44 self.slug = 'marionette'
5− self.type = 'marionette'
5+ self.type = 'simple'
66 self.root_path = 'index'
77 self.links = {
88 home: 'https://marionettejs.com/',
@@ -18,6 +18,13 @@ module Docs · 9 unmodified lines
1818 Licensed under the MIT License.
1919 HTML
2020
21+ version '4' do
22+ self.release = '4.0.0'
23+ self.base_url = "https://marionettejs.com/docs/v#{release}/"
24+
25+ html_filters.push 'marionette/entries_v3'
26+ end
27+
2128 version '3' do
2229 self.release = '3.5.1'
2330 self.base_url = "https://marionettejs.com/docs/v#{release}/"
lib/docs/scrapers/markdown.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Markdown < UrlScraper
33 self.name = 'Markdown'
4− self.type = 'markdown'
4+ self.type = 'simple'
55 self.base_url = 'http://daringfireball.net/projects/markdown/syntax'
66
77 html_filters.push 'markdown/clean_html', 'markdown/entries'
lib/docs/scrapers/mocha.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Mocha < UrlScraper
3− self.type = 'mocha'
3+ self.type = 'simple'
44 self.release = '5.0.1'
55 self.base_url = 'https://mochajs.org/'
66 self.links = {
lib/docs/scrapers/mongoose.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Mongoose < UrlScraper
33 self.name = 'Mongoose'
4− self.type = 'mongoose'
4+ self.type = 'simple'
55 self.release = '4.13.1'
66 self.base_url = 'http://mongoosejs.com/docs/'
77 self.root_path = 'index.html'
lib/docs/scrapers/nim.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Nim < UrlScraper
3− self.type = 'nim'
3+ self.type = 'simple'
44 self.release = '0.18.0'
55 self.base_url = 'https://nim-lang.org/docs/'
66 self.root_path = 'overview.html'
lib/docs/scrapers/node.rb+3−3
@@ -23,17 +23,17 @@ module Docs · 22 unmodified lines
2323 HTML
2424
2525 version do
26− self.release = '10.6.0'
26+ self.release = '10.9.0'
2727 self.base_url = 'https://nodejs.org/dist/latest-v10.x/docs/api/'
2828 end
2929
3030 version '8 LTS' do
31− self.release = '8.11.2'
31+ self.release = '8.11.4'
3232 self.base_url = 'https://nodejs.org/dist/latest-v8.x/docs/api/'
3333 end
3434
3535 version '6 LTS' do
36− self.release = '6.14.2'
36+ self.release = '6.14.4'
3737 self.base_url = 'https://nodejs.org/dist/latest-v6.x/docs/api/'
3838 end
3939
lib/docs/scrapers/npm.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Npm < UrlScraper
33 self.name = 'npm'
44 self.type = 'npm'
5− self.release = '6.1.0'
5+ self.release = '6.4.0'
66 self.base_url = 'https://docs.npmjs.com/'
77 self.force_gzip = true
88 self.links = {
lib/docs/scrapers/php.rb+1−1
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
44
55 self.name = 'PHP'
66 self.type = 'php'
7− self.release = '7.2.5'
7+ self.release = '7.2.9'
88 self.base_url = 'https://secure.php.net/manual/en/'
99 self.root_path = 'index.html'
1010 self.initial_paths = %w(
lib/docs/scrapers/puppeteer.rb+18−0
@@ -0,0 +1,18 @@
1+module Docs
2+ class Puppeteer < Github
3+ self.release = '1.8.0'
4+ self.base_url = 'https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md'
5+ self.links = {
6+ code: 'https://github.com/GoogleChrome/puppeteer'
7+ }
8+
9+ html_filters.push 'puppeteer/entries', 'puppeteer/clean_html'
10+
11+ options[:container] = '.markdown-body'
12+
13+ options[:attribution] = <<-HTML
14+ &copy; 2017 Google Inc<br>
15+ Licensed under the Apache License 2.0.
16+ HTML
17+ end
18+end
lib/docs/scrapers/pygame.rb+20−0
@@ -0,0 +1,20 @@
1+module Docs
2+ class Pygame < UrlScraper
3+ self.type = 'simple'
4+ self.release = '1.9.4'
5+ self.root_path = 'py-modindex.html'
6+ self.links = {
7+ home: 'https://www.pygame.org/',
8+ code: 'https://github.com/pygame/pygame'
9+ }
10+
11+ html_filters.push 'pygame/clean_html', 'pygame/entries'
12+
13+ options[:only_patterns] = [/ref\//]
14+
15+ options[:attribution] = <<-HTML
16+ &copy; Pygame Developpers.<br>
17+ Licensed under the GNU LGPL License version 2.1.
18+ HTML
19+ end
20+end
lib/docs/scrapers/qt.rb+121−0
@@ -0,0 +1,121 @@
1+module Docs
2+ class Qt < UrlScraper
3+ self.name = 'Qt'
4+ self.type = 'qt'
5+ self.initial_paths = %w(classes.html qmltypes.html)
6+ self.root_path = 'index.html'
7+ self.links = {
8+ home: 'https://www.qt.io',
9+ code: 'https://code.qt.io/cgit/'
10+ }
11+
12+ html_filters.push 'qt/entries', 'qt/clean_html'
13+
14+ options[:container] = '.main'
15+ options[:max_image_size] = 156_000
16+ options[:skip_patterns] = [
17+ # License, copyright attributions
18+ /3rdparty/,
19+ /attribution/,
20+ /license/,
21+ /licensing/,
22+
23+ # Examples, guides, tutorials
24+ /example/,
25+ /guide$/,
26+ /tutorial/,
27+ /porting/,
28+ /usecase/,
29+ /topic/,
30+ /^modelview/,
31+ /deploy(ing|ment)/,
32+ /building/,
33+
34+ # Old versions, changelog
35+ /obsolete/,
36+ /compatibility/,
37+ /^whatsnew/,
38+ /^newclasses/,
39+
40+ # Deprecated modules
41+ /(qtopengl|qgl)/,
42+ /qt?script/,
43+
44+ # Indexes
45+ /members/,
46+ /module/,
47+ /overview/,
48+ /^qopenglfunctions/,
49+
50+ # Tooling
51+ /^(qt)?(linguist|assistant|qdbusviewer)/,
52+ ]
53+
54+ options[:skip] = [
55+ "qt5-intro.html",
56+ "compatmap.html",
57+
58+ # Indexes
59+ "classes.html",
60+ "qtmodules.html",
61+ "modules-qml.html",
62+ "modules-cpp.html",
63+ "functions.html",
64+ "namespaces.html",
65+ "qmltypes.html",
66+ "qt3d-qml.html",
67+ "qmlbasictypes.html",
68+ "guibooks.html",
69+ "annotated.html",
70+ "overviews-main.html",
71+ "reference-overview.html",
72+
73+ # Tutorials
74+ "qtvirtualkeyboard-build.html",
75+
76+ # Copyright
77+ "trademarks.html",
78+ "lgpl.html",
79+ "bughowto.html",
80+
81+ # Changelogs
82+ "changes.html",
83+ "qtlocation-changes.html",
84+ "sourcebreaks.html",
85+
86+ # Best practice guides
87+ "accessible.html",
88+ "accessible-qtquick.html",
89+ "sharedlibrary.html",
90+ "exceptionsafety.html",
91+ "scalability.html",
92+ "session.html",
93+ "appicon.html",
94+ "accelerators.html",
95+
96+ # Other
97+ "ecmascript.html",
98+ "qtremoteobjects-interaction.html",
99+ ]
100+
101+ options[:attribution] = <<-HTML
102+ &copy; The Qt Company Ltd<br>
103+ Licensed under the GNU Free Documentation License, Version 1.3.
104+ HTML
105+
106+ version '5.11' do
107+ self.release = '5.11'
108+ self.base_url = 'https://doc.qt.io/qt-5/'
109+ end
110+
111+ version '5.9' do
112+ self.release = '5.9'
113+ self.base_url = 'https://doc.qt.io/qt-5.9/'
114+ end
115+
116+ version '5.6' do
117+ self.release = '5.6'
118+ self.base_url = 'https://doc.qt.io/qt-5.6/'
119+ end
120+ end
121+end
lib/docs/scrapers/redis.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Redis < UrlScraper
33 self.type = 'redis'
4− self.release = '4.0.9'
4+ self.release = '4.0.11'
55 self.base_url = 'https://redis.io/commands'
66 self.links = {
77 home: 'https://redis.io/',
lib/docs/scrapers/redux.rb+1−1
@@ -1,6 +1,6 @@
11 module Docs
22 class Redux < UrlScraper
3− self.type = 'redux'
3+ self.type = 'simple'
44 self.release = '3.7.2'
55 self.base_url = 'http://redux.js.org/docs/'
66 self.links = {
lib/docs/scrapers/requirejs.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Requirejs < UrlScraper
33 self.name = 'RequireJS'
4− self.type = 'requirejs'
4+ self.type = 'simple'
55 self.release = '2.3.5'
66 self.base_url = 'http://requirejs.org/docs/'
77 self.links = {
lib/docs/scrapers/rust.rb+5−5
@@ -1,9 +1,9 @@
11 module Docs
22 class Rust < UrlScraper
33 self.type = 'rust'
4− self.release = '1.26.0'
4+ self.release = '1.29.1'
55 self.base_url = 'https://doc.rust-lang.org/'
6− self.root_path = 'book/first-edition/index.html'
6+ self.root_path = 'book/second-edition/index.html'
77 self.initial_paths = %w(
88 reference/introduction.html
99 collections/index.html
@@ -17,13 +17,13 @@ module Docs · 7 unmodified lines
1717 html_filters.push 'rust/entries', 'rust/clean_html'
1818
1919 options[:only_patterns] = [
20− /\Abook\/first-edition\//,
20+ /\Abook\/second-edition\//,
2121 /\Areference\//,
2222 /\Acollections\//,
2323 /\Astd\// ]
2424
25− options[:skip] = %w(book/first-edition/README.html)
26− options[:skip_patterns] = [/(?<!\.html)\z/]
25+ options[:skip] = %w(book/second-edition/README.html)
26+ options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/]
2727
2828 options[:fix_urls] = ->(url) do
2929 url.sub! %r{(#{Rust.base_url}.+/)\z}, '\1index.html'
lib/docs/scrapers/typescript.rb+2−2
@@ -1,8 +1,8 @@
11 module Docs
22 class Typescript < UrlScraper
33 self.name = 'TypeScript'
4− self.type = 'typescript'
5− self.release = '2.9.0'
4+ self.type = 'simple'
5+ self.release = '3.0.1'
66 self.base_url = 'https://www.typescriptlang.org/docs/'
77 self.root_path = 'tutorial.html'
88 self.links = {
lib/docs/scrapers/vagrant.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Vagrant < UrlScraper
33 self.name = 'Vagrant'
4− self.type = 'vagrant'
4+ self.type = 'simple'
55 self.release = '2.1.1'
66 self.base_url = 'https://www.vagrantup.com/docs/'
77 self.root_path = 'index.html'
lib/docs/scrapers/vulkan.rb+1−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Vulkan < UrlScraper
33 self.name = 'Vulkan'
4− self.type = 'vulkan'
4+ self.type = 'simple'
55 self.release = '1.0.59'
66 self.base_url = 'https://www.khronos.org/registry/vulkan/specs/1.0/'
77 self.root_path = 'apispec.html'
lib/docs/scrapers/webpack.rb+1−1
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
44 self.type = 'webpack'
55
66 version do
7− self.release = '4.12.0'
7+ self.release = '4.16.5'
88 self.base_url = 'https://webpack.js.org/'
99 self.root_path = 'guides/'
1010 self.initial_paths = %w(
lib/docs/scrapers/yarn.rb+2−2
@@ -1,7 +1,7 @@
11 module Docs
22 class Yarn < UrlScraper
3− self.type = 'yarn'
4− self.release = '1.7.0'
3+ self.type = 'simple'
4+ self.release = '1.9.4'
55 self.base_url = 'https://yarnpkg.com/en/docs/'
66 self.links = {
77 home: 'https://yarnpkg.com/',