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
1313 steps:
1414 - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
1515 - name: Set up Ruby
16− uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
16+ uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0
1717 with:
1818 bundler-cache: true # runs 'bundle install' and caches installed gems automatically
1919 - name: Run tests
.github/workflows/schedule-doc-report.yml+1−1
@@ -11,7 +11,7 @@ jobs: · 10 unmodified lines
1111 steps:
1212 - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
1313 - name: Set up Ruby
14− uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
14+ uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0
1515 with:
1616 bundler-cache: true # runs 'bundle install' and caches installed gems automatically
1717 - name: Generate report
.github/workflows/test.yml+1−1
@@ -11,7 +11,7 @@ jobs: · 10 unmodified lines
1111 steps:
1212 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
1313 - name: Set up Ruby
14− uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
14+ uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0
1515 with:
1616 bundler-cache: true # runs 'bundle install' and caches installed gems automatically
1717 - name: Run tests
Gemfile.lock+2−2
@@ -1,7 +1,7 @@
11 GEM
22 remote: https://rubygems.org/
33 specs:
4− activesupport (7.1.3.3)
4+ activesupport (7.1.3.4)
55 base64
66 bigdecimal
77 concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -125,7 +125,7 @@ GEM · 117 unmodified lines
125125 strings-ansi (0.2.0)
126126 terminal-table (3.0.2)
127127 unicode-display_width (>= 1.1.1, < 3)
128− terser (1.2.2)
128+ terser (1.2.3)
129129 execjs (>= 0.3.0, < 3)
130130 thin (1.8.2)
131131 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
172172 | [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) |
173173 | [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) |
174174 | [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) |
175176 | [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) |
176177 | [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) |
177178 | [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 @@
11 [
2+ [
3+ "2024-02-20",
4+ "New documentations: <a href=\"/nextjs/\">Next.js</a>, <a href=\"/click/\">click</a>"
5+ ],
26 [
37 "2024-01-24",
48 "New documentation: <a href=\"/playwright/\">Playwright</a>"
lib/docs/filters/click/entries.rb+58−0
@@ -0,0 +1,58 @@
1+module 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
58+end
lib/docs/filters/click/pre_clean_html.rb+11−0
@@ -0,0 +1,11 @@
1+module 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
11+end
lib/docs/filters/elisp/entries.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Elisp
33 class EntriesFilter < Docs::EntriesFilter
44 def get_name
5− # remove numbers at the beginnig
5+ # remove numbers at the beginning
66 name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').content.slice(/[[:alpha:]]...*/)
77
88 # remove 'Appendix' word
lib/docs/filters/gtk/entries.rb+1−1
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
44 # The GTK documentation paths are "flat" and while the contents of each
55 # page provides a way to determine the direct parent relationship, we
66 # 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 generate
7+ # categorize all pages and entries. So we're going to recursively generate
88 # a full map of page -> parent relationships from the table of contents...
99 PARENT_BY_PATH = {}
1010
lib/docs/filters/kubectl/entries.rb+1−1
@@ -15,7 +15,7 @@ module Docs · 14 unmodified lines
1515 group = 'kubectl'
1616 commands = css('h1').to_a()
1717 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)
1919 new_group = at_css("##{node['id']} > strong")
2020 if new_group
2121 group = new_group.content.titleize
lib/docs/filters/nextjs/clean_html.rb+30−0
@@ -0,0 +1,30 @@
1+module 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
30+end
lib/docs/filters/nextjs/entries.rb+43−0
@@ -0,0 +1,43 @@
1+module 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
43+end
lib/docs/scrapers/click.rb+30−0
@@ -0,0 +1,30 @@
1+module 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
30+end
lib/docs/scrapers/crystal.rb+1−1
@@ -36,7 +36,7 @@ module Docs · 35 unmodified lines
3636
3737 def get_latest_version(opts)
3838 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]
4040 end
4141 end
4242 end
lib/docs/scrapers/docker.rb+1−1
@@ -96,7 +96,7 @@ module Docs · 95 unmodified lines
9696
9797 def get_latest_version(opts)
9898 doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts)
99− latest_version = doc.at_css('.content > section > h2').content.strip
99+ latest_version = doc.at_css('.DocSearch-content > h2 > a').content.strip
100100 latest_version.rpartition(' ')[-1]
101101 end
102102 end
lib/docs/scrapers/nextjs.rb+26−0
@@ -0,0 +1,26 @@
1+module 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
26+end
lib/docs/scrapers/node.rb+2−2
@@ -74,8 +74,8 @@ module Docs · 73 unmodified lines
7474 end
7575
7676 def get_latest_version(opts)
77− doc = fetch_doc('https://nodejs.org/en/', opts)
78− doc.at_css('#home-intro > .home-downloadblock:last-of-type > a')['data-version'][1..-1]
77+ tags = get_github_tags('nodejs', 'node', opts)
78+ tags[0]['name'][1..-1]
7979 end
8080 end
8181 end
lib/docs/scrapers/octave.rb+1−1
@@ -51,7 +51,7 @@ module Docs · 50 unmodified lines
5151
5252 def get_latest_version(opts)
5353 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]
5555 end
5656
5757 end
lib/docs/scrapers/phalcon.rb+2−2
@@ -31,8 +31,8 @@ module Docs · 30 unmodified lines
3131 end
3232
3333 def get_latest_version(opts)
34− doc = fetch_doc('https://docs.phalconphp.com/', opts)
35− doc.at_css('.header__lang.expand > div > ul > li > a').content
34+ tags = get_github_tags('phalcon', 'cphalcon', opts)
35+ tags[0]['name'][1..-1]
3636 end
3737 end
3838 end
lib/docs/scrapers/sanctuary_type_classes.rb+1−1
@@ -23,7 +23,7 @@ module Docs · 22 unmodified lines
2323 HTML
2424
2525 def get_latest_version(opts)
26− get-npm-version("sanctuary-type-classes", opts)
26+ get_npm_version("sanctuary-type-classes", opts)
2727 end
2828 end
2929 end
lib/docs/scrapers/vite.rb+1−1
@@ -22,7 +22,7 @@ module Docs · 21 unmodified lines
2222 html_filters.push 'vite/entries', 'vite/clean_html'
2323
2424 version do
25− self.release = '5.0.11'
25+ self.release = '5.2.13'
2626 self.base_url = 'https://vitejs.dev/'
2727 end
2828
lib/docs/scrapers/vue.rb+1−1
@@ -19,7 +19,7 @@ module Docs · 18 unmodified lines
1919 HTML
2020
2121 version '3' do
22− self.release = '3.4.5'
22+ self.release = '3.4.27'
2323 self.base_url = 'https://vuejs.org/'
2424 self.initial_paths = %w(guide/introduction.html)
2525 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 @@
1+https://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 @@
1+https://assets.vercel.com/image/upload/v1662130559/nextjs/Icon_dark_background.png
2+https://github.com/vercel/next.js/blob/canary/examples/cms-enterspeed/public/favicon/favicon.ico