History

Merge branch 'main' into update-zig-to-0.12

Simon Legner committed 2 years ago

Commit 08fc2202 parents 4742412 6512f2930 files · +226 −14Browse files

Unified · Split

30 files
  1. .github/workflows/build.yml +1 −1
  2. .github/workflows/schedule-doc-report.yml +1 −1
  3. .github/workflows/test.yml +1 −1
  4. Gemfile.lock +2 −2
  5. README.md +1 −0
  6. assets/javascripts/news.json +4 −0
  7. lib/docs/filters/click/entries.rb +58 −0
  8. lib/docs/filters/click/pre_clean_html.rb +11 −0
  9. lib/docs/filters/elisp/entries.rb +1 −1
  10. lib/docs/filters/gtk/entries.rb +1 −1
  11. lib/docs/filters/kubectl/entries.rb +1 −1
  12. lib/docs/filters/nextjs/clean_html.rb +30 −0
  13. lib/docs/filters/nextjs/entries.rb +43 −0
  14. lib/docs/scrapers/click.rb +30 −0
  15. lib/docs/scrapers/crystal.rb +1 −1
  16. lib/docs/scrapers/docker.rb +1 −1
  17. lib/docs/scrapers/nextjs.rb +26 −0
  18. lib/docs/scrapers/node.rb +2 −2
  19. lib/docs/scrapers/octave.rb +1 −1
  20. lib/docs/scrapers/phalcon.rb +2 −2
  21. lib/docs/scrapers/sanctuary_type_classes.rb +1 −1
  22. lib/docs/scrapers/vite.rb +1 −1
  23. lib/docs/scrapers/vue.rb +1 −1
  24. package-lock.json +6 −0
  25. public/icons/docs/click/16.png +0 −0
  26. public/icons/docs/click/16@2x.png +0 −0
  27. public/icons/docs/click/SOURCE +1 −0
  28. public/icons/docs/nextjs/16.png +0 −0
  29. public/icons/docs/nextjs/16@2x.png +0 −0
  30. public/icons/docs/nextjs/SOURCE +2 −0
.github/workflows/build.yml+1−1
@@ -13,7 +13,7 @@ jobs: · 12 unmodified lines
13 steps:13 steps:
14 - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.014 - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
15 - name: Set up Ruby15 - name: Set up Ruby
16 uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.016 uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0
17 with:17 with:
18 bundler-cache: true # runs 'bundle install' and caches installed gems automatically18 bundler-cache: true # runs 'bundle install' and caches installed gems automatically
19 - name: Run tests19 - name: Run tests
.github/workflows/schedule-doc-report.yml+1−1
@@ -11,7 +11,7 @@ jobs: · 10 unmodified lines
11 steps:11 steps:
12 - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.012 - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
13 - name: Set up Ruby13 - name: Set up Ruby
14 uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.014 uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0
15 with:15 with:
16 bundler-cache: true # runs 'bundle install' and caches installed gems automatically16 bundler-cache: true # runs 'bundle install' and caches installed gems automatically
17 - name: Generate report17 - name: Generate report
.github/workflows/test.yml+1−1
@@ -11,7 +11,7 @@ jobs: · 10 unmodified lines
11 steps:11 steps:
12 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.612 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
13 - name: Set up Ruby13 - name: Set up Ruby
14 uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.014 uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0
15 with:15 with:
16 bundler-cache: true # runs 'bundle install' and caches installed gems automatically16 bundler-cache: true # runs 'bundle install' and caches installed gems automatically
17 - name: Run tests17 - name: Run tests
Gemfile.lock+2−2
@@ -1,7 +1,7 @@
1GEM1GEM
2 remote: https://rubygems.org/2 remote: https://rubygems.org/
3 specs:3 specs:
4 activesupport (7.1.3.3)4 activesupport (7.1.3.4)
5 base645 base64
6 bigdecimal6 bigdecimal
7 concurrent-ruby (~> 1.0, >= 1.0.2)7 concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -125,7 +125,7 @@ GEM · 117 unmodified lines
125 strings-ansi (0.2.0)125 strings-ansi (0.2.0)
126 terminal-table (3.0.2)126 terminal-table (3.0.2)
127 unicode-display_width (>= 1.1.1, < 3)127 unicode-display_width (>= 1.1.1, < 3)
128 terser (1.2.2)128 terser (1.2.3)
129 execjs (>= 0.3.0, < 3)129 execjs (>= 0.3.0, < 3)
130 thin (1.8.2)130 thin (1.8.2)
131 daemons (~> 1.0, >= 1.0.9)131 daemons (~> 1.0, >= 1.0.9)
README.md+1−0
@@ -172,6 +172,7 @@ Made something cool? Feel free to open a PR to add a new row to this table! You · 171 unmodified lines
172| [mohamed3nan/DevDocs-Tab](https://github.com/mohamed3nan/DevDocs-Tab) | VS Code extension (view as tab) | ![Latest GitHub commit](https://img.shields.io/github/last-commit/mohamed3nan/DevDocs-Tab?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/mohamed3nan/DevDocs-Tab?logo=github&label) |172| [mohamed3nan/DevDocs-Tab](https://github.com/mohamed3nan/DevDocs-Tab) | VS Code extension (view as tab) | ![Latest GitHub commit](https://img.shields.io/github/last-commit/mohamed3nan/DevDocs-Tab?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/mohamed3nan/DevDocs-Tab?logo=github&label) |
173| [deibit/vscode-devdocs](https://marketplace.visualstudio.com/items?itemName=deibit.devdocs) | VS Code extension (open the browser) | ![Latest GitHub commit](https://img.shields.io/github/last-commit/deibit/vscode-devdocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/deibit/vscode-devdocs?logo=github&label) |173| [deibit/vscode-devdocs](https://marketplace.visualstudio.com/items?itemName=deibit.devdocs) | VS Code extension (open the browser) | ![Latest GitHub commit](https://img.shields.io/github/last-commit/deibit/vscode-devdocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/deibit/vscode-devdocs?logo=github&label) |
174| [mdh34/quickDocs](https://github.com/mdh34/quickDocs) | Vala/Python based viewer | ![Latest GitHub commit](https://img.shields.io/github/last-commit/mdh34/quickDocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/mdh34/quickDocs?logo=github&label) |174| [mdh34/quickDocs](https://github.com/mdh34/quickDocs) | Vala/Python based viewer | ![Latest GitHub commit](https://img.shields.io/github/last-commit/mdh34/quickDocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/mdh34/quickDocs?logo=github&label) |
175| [girishji/devdocs.vim](https://github.com/girishji/devdocs.vim) | Vim plugin & TUI (browse inside Vim) | ![Latest GitHub commit](https://img.shields.io/github/last-commit/girishji/devdocs.vim?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/girishji/devdocs.vim?logo=github&label) |
175| [romainl/vim-devdocs](https://github.com/romainl/vim-devdocs) | Vim plugin | ![Latest GitHub commit](https://img.shields.io/github/last-commit/romainl/vim-devdocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/romainl/vim-devdocs?logo=github&label) |176| [romainl/vim-devdocs](https://github.com/romainl/vim-devdocs) | Vim plugin | ![Latest GitHub commit](https://img.shields.io/github/last-commit/romainl/vim-devdocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/romainl/vim-devdocs?logo=github&label) |
176| [waiting-for-dev/vim-www](https://github.com/waiting-for-dev/vim-www) | Vim plugin | ![Latest GitHub commit](https://img.shields.io/github/last-commit/waiting-for-dev/vim-www?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/waiting-for-dev/vim-www?logo=github&label) |177| [waiting-for-dev/vim-www](https://github.com/waiting-for-dev/vim-www) | Vim plugin | ![Latest GitHub commit](https://img.shields.io/github/last-commit/waiting-for-dev/vim-www?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/waiting-for-dev/vim-www?logo=github&label) |
177| [luckasRanarison/nvim-devdocs](https://github.com/luckasRanarison/nvim-devdocs) | Neovim plugin | ![Latest GitHub commit](https://img.shields.io/github/last-commit/luckasRanarison/nvim-devdocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/luckasRanarison/nvim-devdocs?logo=github&label) |178| [luckasRanarison/nvim-devdocs](https://github.com/luckasRanarison/nvim-devdocs) | Neovim plugin | ![Latest GitHub commit](https://img.shields.io/github/last-commit/luckasRanarison/nvim-devdocs?logo=github&label) | ![GitHub stars](https://img.shields.io/github/stars/luckasRanarison/nvim-devdocs?logo=github&label) |
assets/javascripts/news.json+4−0
@@ -1,4 +1,8 @@
1[1[
2 [
3 "2024-02-20",
4 "New documentations: <a href=\"/nextjs/\">Next.js</a>, <a href=\"/click/\">click</a>"
5 ],
2 [6 [
3 "2024-01-24",7 "2024-01-24",
4 "New documentation: <a href=\"/playwright/\">Playwright</a>"8 "New documentation: <a href=\"/playwright/\">Playwright</a>"
lib/docs/filters/click/entries.rb+58−0
@@ -0,0 +1,58 @@
1module Docs
2 class Click
3 class EntriesFilter < Docs::EntriesFilter
4 TYPE_BY_SLUG = {}
5
6 def call
7 if root_page?
8 css('section').each do |node|
9 next if ['documentation', 'api-reference'].include?(node['id'])
10 type = node.at_css('h2').content.strip
11 node.css('li > a').each do |toclink|
12 slug = toclink['href'].split('/')[-2]
13 TYPE_BY_SLUG[slug] = type
14 end
15 end
16 end
17 super
18 end
19
20 def get_name
21 return at_css('h1').content.strip
22 end
23
24 def get_type
25 TYPE_BY_SLUG[slug.split('/').first] || at_css('h1').content.strip
26 end
27
28 def include_default_entry?
29 TYPE_BY_SLUG.include?(slug.split('/').first)
30 end
31
32 def additional_entries
33 return [] if root_page? || TYPE_BY_SLUG.include?(slug.split('/').first)
34
35 if slug == 'api/'
36 entries = []
37 doc.css('> section').each do |section|
38 title = section.at_css('h2').content.strip
39 section.css('dl.py > dt[id]').each do |dt|
40 name = dt['id'].split('.')[1..].join('.')
41 name << '()' if dt.parent.classes.intersect?(['function', 'method', 'classmethod', 'staticmethod'])
42 entries << [name, dt['id'], title]
43 end
44 end
45 return entries
46 end
47
48 (doc.css('> section') || []).map do |section|
49 title = section.at_css('h2').content.strip
50 [title, section['id']]
51 end
52 end
53
54 private
55
56 end
57 end
58end
lib/docs/filters/click/pre_clean_html.rb+11−0
@@ -0,0 +1,11 @@
1module Docs
2 class Click
3 class PreCleanHtmlFilter < Filter
4 def call
5 # Remove ¶ character from headers
6 css('.headerlink').remove
7 doc
8 end
9 end
10 end
11end
lib/docs/filters/elisp/entries.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Elisp2 class Elisp
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 def get_name
5 # remove numbers at the beginnig5 # remove numbers at the beginning
6 name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').content.slice(/[[:alpha:]]...*/)6 name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').content.slice(/[[:alpha:]]...*/)
7 7
8 # remove 'Appendix' word8 # remove 'Appendix' word
lib/docs/filters/gtk/entries.rb+1−1
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
4 # The GTK documentation paths are "flat" and while the contents of each4 # The GTK documentation paths are "flat" and while the contents of each
5 # page provides a way to determine the direct parent relationship, we5 # page provides a way to determine the direct parent relationship, we
6 # really need a full hierarchy of pages *a priori* to be able to fully6 # really need a full hierarchy of pages *a priori* to be able to fully
7 # categorize all pages and entries. So we're going to recursivly generate7 # categorize all pages and entries. So we're going to recursively generate
8 # a full map of page -> parent relationships from the table of contents...8 # a full map of page -> parent relationships from the table of contents...
9 PARENT_BY_PATH = {}9 PARENT_BY_PATH = {}
10 10
lib/docs/filters/kubectl/entries.rb+1−1
@@ -15,7 +15,7 @@ module Docs · 14 unmodified lines
15 group = 'kubectl'15 group = 'kubectl'
16 commands = css('h1').to_a()16 commands = css('h1').to_a()
17 commands.map do |node|17 commands.map do |node|
18 # handle titles differnetly by converting them into sidebar groups (types)18 # handle titles differently by converting them into sidebar groups (types)
19 new_group = at_css("##{node['id']} > strong")19 new_group = at_css("##{node['id']} > strong")
20 if new_group20 if new_group
21 group = new_group.content.titleize21 group = new_group.content.titleize
lib/docs/filters/nextjs/clean_html.rb+30−0
@@ -0,0 +1,30 @@
1module Docs
2 class Nextjs
3 class CleanHtmlFilter < Filter
4 def call
5 @doc = at_css('.prose')
6
7 css('.zola-anchor').remove
8 doc.prepend_child("<h1>NextJS2</h1>") if root_page?
9 css('div:contains("NEWS:")').remove
10 css('h2:contains("sponsors"), #sponsor-table').remove
11 css('div.sticky').remove #remove the floating menu
12 css('div.-mt-4').remove #remove the navigation line
13 css('footer').remove
14 css('div.feedback_inlineTriggerWrapper__o7yUx').remove
15 css('header').remove #remove links from the top of the page
16 css('nav').remove
17
18 css('h1, h2, h3, h4').each { |node| node.content = node.content }
19
20 css('pre > code').each do |node|
21 node.parent['data-language'] = 'typescript'
22 node.parent.content = node.parent.content
23 end
24 css('div[class^="code-block_header"]').remove
25
26 doc
27 end
28 end
29 end
30end
lib/docs/filters/nextjs/entries.rb+43−0
@@ -0,0 +1,43 @@
1module Docs
2 class Nextjs
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 name = at_css('h1').content
6 name.strip!
7 #name
8 subpath_items = subpath.split('/', -1)
9 if subpath_items.length >= 5
10 subpath_items[3].capitalize + ': ' + name # e.g. Routing: Defining Routes
11 else
12 name
13 end
14 end
15
16 def get_type
17 if slug.start_with?('architecture')
18 'Architecture'
19 elsif slug.start_with?('community')
20 'Community'
21 elsif slug.start_with?('getting-started')
22 'Getting Started'
23 elsif slug.start_with?('messages')
24 'Messages'
25 elsif slug.start_with?('app/building-your-application')
26 'Using App Router: Building your application'
27 elsif slug.start_with?('app/api-reference')
28 'Using App Router: api-reference'
29 elsif slug.start_with?('app')
30 'Using App Router'
31 elsif slug.start_with?('pages/building-your-application')
32 'Using Pages Router: Building your application'
33 elsif slug.start_with?('pages/api-reference')
34 'Using Pages Router: api-reference'
35 elsif slug.start_with?('pages')
36 'Using Pages Router'
37 else
38 get_name
39 end
40 end
41 end
42 end
43end
lib/docs/scrapers/click.rb+30−0
@@ -0,0 +1,30 @@
1module Docs
2 class Click < UrlScraper
3 self.name = 'click'
4 self.type = 'sphinx'
5 self.root_path = 'index.html'
6 self.links = {
7 home: 'https://click.palletsprojects.com/',
8 code: 'https://github.com/pallets/click'
9 }
10
11 html_filters.push 'click/pre_clean_html', 'click/entries', 'sphinx/clean_html'
12
13 options[:container] = '.body > section'
14 options[:skip] = ['changes/', 'genindex/', 'py-modindex/']
15 options[:title] = false
16
17 options[:attribution] = <<-HTML
18 &copy; Copyright 2014 Pallets.<br>
19 Licensed under the BSD 3-Clause License.<br>
20 We are not supported nor endorsed by Pallets.
21 HTML
22
23 self.release = '8.1.x'
24 self.base_url = "https://click.palletsprojects.com/en/#{self.release}/"
25
26 def get_latest_version(opts)
27 get_latest_github_release('pallets', 'click', opts)
28 end
29 end
30end
lib/docs/scrapers/crystal.rb+1−1
@@ -36,7 +36,7 @@ module Docs · 35 unmodified lines
36 36
37 def get_latest_version(opts)37 def get_latest_version(opts)
38 doc = fetch_doc('https://crystal-lang.org/', opts)38 doc = fetch_doc('https://crystal-lang.org/', opts)
39 doc.at_css('.latest-release').content.scan(/([0-9.]+)/)[0][0]39 doc.at_css('.latest-release-info > a > strong').content.scan(/([0-9.]+)/)[0][0]
40 end40 end
41 end41 end
42end42end
lib/docs/scrapers/docker.rb+1−1
@@ -96,7 +96,7 @@ module Docs · 95 unmodified lines
96 96
97 def get_latest_version(opts)97 def get_latest_version(opts)
98 doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts)98 doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts)
99 latest_version = doc.at_css('.content > section > h2').content.strip99 latest_version = doc.at_css('.DocSearch-content > h2 > a').content.strip
100 latest_version.rpartition(' ')[-1]100 latest_version.rpartition(' ')[-1]
101 end101 end
102 end102 end
lib/docs/scrapers/nextjs.rb+26−0
@@ -0,0 +1,26 @@
1module Docs
2 class Nextjs < UrlScraper
3 self.name = 'Next.js'
4 self.slug = 'nextjs'
5 self.type = 'simple'
6 self.release = '14.2.4'
7 self.base_url = 'https://nextjs.org/docs'
8 self.initial_paths = %w(reference/)
9 self.links = {
10 home: 'https://www.nextjs.org/',
11 code: 'https://github.com/vercel/next.js'
12 }
13
14 html_filters.push 'nextjs/entries', 'nextjs/clean_html'
15 options[:download_images] = false
16
17 options[:attribution] = <<-HTML
18 &copy; 2024 Vercel, Inc.<br>
19 Licensed under the MIT License.
20 HTML
21
22 def get_latest_version(opts)
23 get_npm_version('next', opts)
24 end
25 end
26end
lib/docs/scrapers/node.rb+2−2
@@ -74,8 +74,8 @@ module Docs · 73 unmodified lines
74 end74 end
75 75
76 def get_latest_version(opts)76 def get_latest_version(opts)
77 doc = fetch_doc('https://nodejs.org/en/', opts)77 tags = get_github_tags('nodejs', 'node', opts)
78 doc.at_css('#home-intro > .home-downloadblock:last-of-type > a')['data-version'][1..-1]78 tags[0]['name'][1..-1]
79 end79 end
80 end80 end
81end81end
lib/docs/scrapers/octave.rb+1−1
@@ -51,7 +51,7 @@ module Docs · 50 unmodified lines
51 51
52 def get_latest_version(opts)52 def get_latest_version(opts)
53 doc = fetch_doc('https://octave.org/doc/interpreter/', opts)53 doc = fetch_doc('https://octave.org/doc/interpreter/', opts)
54 doc.at_css('h1').content.scan(/([0-9.]+)/)[0][0]54 doc.at_css('#SEC_Top + p').content.scan(/([0-9.]+)/)[1][0][0..-2]
55 end55 end
56 56
57 end57 end
lib/docs/scrapers/phalcon.rb+2−2
@@ -31,8 +31,8 @@ module Docs · 30 unmodified lines
31 end31 end
32 32
33 def get_latest_version(opts)33 def get_latest_version(opts)
34 doc = fetch_doc('https://docs.phalconphp.com/', opts)34 tags = get_github_tags('phalcon', 'cphalcon', opts)
35 doc.at_css('.header__lang.expand > div > ul > li > a').content35 tags[0]['name'][1..-1]
36 end36 end
37 end37 end
38end38end
lib/docs/scrapers/sanctuary_type_classes.rb+1−1
@@ -23,7 +23,7 @@ module Docs · 22 unmodified lines
23 HTML23 HTML
24 24
25 def get_latest_version(opts)25 def get_latest_version(opts)
26 get-npm-version("sanctuary-type-classes", opts)26 get_npm_version("sanctuary-type-classes", opts)
27 end27 end
28 end28 end
29end29end
lib/docs/scrapers/vite.rb+1−1
@@ -22,7 +22,7 @@ module Docs · 21 unmodified lines
22 html_filters.push 'vite/entries', 'vite/clean_html'22 html_filters.push 'vite/entries', 'vite/clean_html'
23 23
24 version do24 version do
25 self.release = '5.0.11'25 self.release = '5.2.13'
26 self.base_url = 'https://vitejs.dev/'26 self.base_url = 'https://vitejs.dev/'
27 end27 end
28 28
lib/docs/scrapers/vue.rb+1−1
@@ -19,7 +19,7 @@ module Docs · 18 unmodified lines
19 HTML19 HTML
20 20
21 version '3' do21 version '3' do
22 self.release = '3.4.5'22 self.release = '3.4.27'
23 self.base_url = 'https://vuejs.org/'23 self.base_url = 'https://vuejs.org/'
24 self.initial_paths = %w(guide/introduction.html)24 self.initial_paths = %w(guide/introduction.html)
25 html_filters.push 'vue/entries_v3', 'vue/clean_html'25 html_filters.push 'vue/entries_v3', 'vue/clean_html'
package-lock.json+6−0
@@ -0,0 +1,6 @@
1{
2 "name": "devdocs",
3 "lockfileVersion": 3,
4 "requires": true,
5 "packages": {}
6}
public/icons/docs/click/16.png+0−0

Binary file not shown.

public/icons/docs/click/16@2x.png+0−0

Binary file not shown.

public/icons/docs/click/SOURCE+1−0
@@ -0,0 +1 @@
1https://github.com/pallets/click/blob/main/docs/_static/click-icon.png
public/icons/docs/nextjs/16.png+0−0

Binary file not shown.

public/icons/docs/nextjs/16@2x.png+0−0

Binary file not shown.

public/icons/docs/nextjs/SOURCE+2−0
@@ -0,0 +1,2 @@
1https://assets.vercel.com/image/upload/v1662130559/nextjs/Icon_dark_background.png
2https://github.com/vercel/next.js/blob/canary/examples/cms-enterspeed/public/favicon/favicon.ico