Skip to content

Commit 20840ba

Browse files
authored
Merge branch 'freeCodeCamp:main' into opengl
2 parents 0b2cde3 + 7d24d97 commit 20840ba

21 files changed

+110
-93
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
1515
- name: Set up Ruby
16-
uses: ruby/setup-ruby@161cd54b698f1fb3ea539faab2e036d409550e3c # v1.187.0
16+
uses: ruby/setup-ruby@50ba3386b050ad5b97a41fcb81240cbee1d1821f # v1.188.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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
1313
- name: Set up Ruby
14-
uses: ruby/setup-ruby@161cd54b698f1fb3ea539faab2e036d409550e3c # v1.187.0
14+
uses: ruby/setup-ruby@50ba3386b050ad5b97a41fcb81240cbee1d1821f # v1.188.0
1515
with:
1616
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
1717
- name: Generate report

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1313
- name: Set up Ruby
14-
uses: ruby/setup-ruby@161cd54b698f1fb3ea539faab2e036d409550e3c # v1.187.0
14+
uses: ruby/setup-ruby@50ba3386b050ad5b97a41fcb81240cbee1d1821f # v1.188.0
1515
with:
1616
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
1717
- name: Run tests

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ group :development do
3939
end
4040

4141
group :docs do
42-
gem 'net-sftp', require: false
4342
gem 'progress_bar', require: false
4443
gem 'redcarpet'
4544
gem 'tty-pager', require: false

Gemfile.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ GEM
5757
mustermann (3.0.0)
5858
ruby2_keywords (~> 0.0.1)
5959
mutex_m (0.2.0)
60-
net-sftp (4.0.0)
61-
net-ssh (>= 5.0.0, < 8.0.0)
62-
net-ssh (7.0.1)
6360
newrelic_rpm (8.16.0)
6461
nokogiri (1.16.6)
6562
mini_portile2 (~> 2.8.2)
@@ -159,7 +156,6 @@ DEPENDENCIES
159156
image_optim
160157
image_optim_pack
161158
minitest
162-
net-sftp
163159
newrelic_rpm
164160
nokogiri
165161
progress_bar

docs/file-scrapers.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,13 @@ mv ./usr/share/doc/openjdk-16-jre-headless/api/ docs/openjdk~$VERSION
196196

197197
## Pandas
198198

199+
From the home directory; `devdocs`, execute below:
200+
199201
```sh
200-
curl https://pandas.pydata.org/docs/pandas.zip | bsdtar --extract --file - --directory=docs/pandas~1
202+
curl https://pandas.pydata.org/docs/pandas.zip -o tmp.zip && unzip tmp.zip -d docs/pandas~2 && rm tmp.zip
201203
```
202204

205+
203206
## PHP
204207
Click the link under the "Many HTML files" column on https://www.php.net/download-docs.php, extract the tarball, change its name to `php` and put it in `docs/`.
205208

lib/docs/filters/elixir/clean_html.rb

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,12 @@ module Docs
22
class Elixir
33
class CleanHtmlFilter < Filter
44
def call
5-
if current_url.path.start_with?('/getting-started')
6-
guide
7-
else
8-
api
9-
end
5+
api
106
doc
117
end
128

13-
def guide
14-
@doc = at_css('#content article')
15-
16-
css('pre > code').each do |node|
17-
node.parent.content = node.content
18-
end
19-
20-
css('div > pre.highlight').each do |node|
21-
node.content = node.content
22-
node['data-language'] = node.parent['class'][/language-(\w+)/, 1]
23-
node.parent.before(node).remove
24-
end
25-
end
26-
279
def api
28-
css('.hover-link', 'footer', ':not(.detail-header) > .view-source').remove
29-
30-
css('h1 .settings').remove
10+
css('.top-search').remove
3111

3212
css('.summary').each do |node|
3313
node.name = 'dl'
@@ -65,6 +45,11 @@ def api
6545
end
6646
end
6747

48+
css('h1 a.icon-action[title="View Source"]').each do |node|
49+
node['class'] = 'source'
50+
node.content = "Source"
51+
end
52+
6853
css('pre').each do |node|
6954
node['data-language'] = 'elixir'
7055
node.content = node.content

lib/docs/filters/elixir/entries.rb

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,35 @@ class Elixir
33
class EntriesFilter < Docs::EntriesFilter
44
def get_name
55
css('h1 .app-vsn').remove
6-
name = (at_css('h1 > span') or at_css('h1')).content.strip
7-
8-
if current_url.path.start_with?('/getting-started')
9-
name.remove(/\.\z/)
10-
else
11-
name = name.split(' ').first unless name.start_with?('mix ') # ecto
12-
name
13-
end
6+
(at_css('h1 > span') or at_css('h1')).content.strip
147
end
158

169
def get_type
17-
if current_url.path.start_with?('/getting-started')
18-
if subpath.start_with?('mix-otp')
19-
'Guide: Mix & OTP'
20-
elsif subpath.start_with?('meta')
21-
'Guide: Metaprogramming'
22-
else
23-
'Guide'
24-
end
10+
section = at_css('h1 a.source').attr('href').match('elixir/pages/([^/]+)/')&.captures&.first
11+
if section == "mix-and-otp"
12+
return "Mix & OTP"
13+
elsif section
14+
return section.gsub("-", " ").capitalize
15+
end
16+
17+
name = at_css('h1 span').text
18+
case name.split(' ').first
19+
when 'mix' then 'Mix Tasks'
20+
when 'Changelog' then 'References'
2521
else
2622
case at_css('h1 small').try(:content)
2723
when 'exception'
2824
'Exceptions'
2925
when 'protocol'
3026
'Protocols'
3127
else
32-
if name.start_with?('Phoenix')
33-
name.split('.')[0..2].join('.')
34-
elsif name.start_with?('mix ')
35-
'Mix Tasks'
36-
else
37-
name.split('.').first
38-
end
28+
name
3929
end
4030
end
4131
end
4232

4333
def additional_entries
44-
return [] if type == 'Exceptions' || type == 'Guide' || root_page?
34+
return [] if root_page?
4535

4636
css('.detail-header').map do |node|
4737
id = node['id']

lib/docs/filters/qunit/clean_html.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Docs
44
class Qunit
55
class CleanHtmlFilter < Filter
66
def call
7-
@doc = at_css('.content[role="main"]')
7+
@doc = at_css('.content[role="main"] > article')
88
css('.sidebar').remove
99
css('pre').each do |node|
1010
node['data-language'] = 'javascript'

lib/docs/scrapers/elixir.rb

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,58 @@ class Elixir < UrlScraper
44

55
self.name = 'Elixir'
66
self.type = 'elixir'
7-
self.root_path = 'api-reference.html'
7+
self.root_path = 'introduction.html'
88
self.links = {
99
home: 'https://elixir-lang.org/',
1010
code: 'https://github.com/elixir-lang/elixir'
1111
}
1212

1313
html_filters.push 'elixir/clean_html', 'elixir/entries', 'title'
1414

15-
options[:container] = ->(filter) {
16-
filter.current_url.path.start_with?('/getting-started') ? '#main' : '#content'
17-
}
15+
options[:container] = '#content'
1816
options[:title] = false
1917
options[:root_title] = 'Elixir'
2018

2119
options[:attribution] = <<-HTML
22-
&copy; 2012 Plataformatec<br>
20+
&copy; 2012-2024 The Elixir Team<br>
2321
Licensed under the Apache License, Version 2.0.
2422
HTML
2523

2624
def initial_urls
27-
[ "https://hexdocs.pm/elixir/#{self.class.release}/api-reference.html",
25+
[ "https://hexdocs.pm/elixir/#{self.class.release}/introduction.html",
2826
"https://hexdocs.pm/eex/#{self.class.release}/EEx.html",
2927
"https://hexdocs.pm/ex_unit/#{self.class.release}/ExUnit.html",
3028
"https://hexdocs.pm/iex/#{self.class.release}/IEx.html",
3129
"https://hexdocs.pm/logger/#{self.class.release}/Logger.html",
32-
"https://hexdocs.pm/mix/#{self.class.release}/Mix.html",
33-
"https://elixir-lang.org/getting-started/introduction.html" ]
30+
"https://hexdocs.pm/mix/#{self.class.release}/Mix.html" ]
31+
end
32+
33+
version '1.17' do
34+
self.release = '1.17.2'
35+
self.base_urls = [
36+
"https://hexdocs.pm/elixir/#{release}/",
37+
"https://hexdocs.pm/eex/#{release}/",
38+
"https://hexdocs.pm/ex_unit/#{release}/",
39+
"https://hexdocs.pm/iex/#{release}/",
40+
"https://hexdocs.pm/logger/#{release}/",
41+
"https://hexdocs.pm/mix/#{release}/"
42+
]
3443
end
3544

45+
version '1.16' do
46+
self.release = '1.16.3'
47+
self.base_urls = [
48+
"https://hexdocs.pm/elixir/#{release}/",
49+
"https://hexdocs.pm/eex/#{release}/",
50+
"https://hexdocs.pm/ex_unit/#{release}/",
51+
"https://hexdocs.pm/iex/#{release}/",
52+
"https://hexdocs.pm/logger/#{release}/",
53+
"https://hexdocs.pm/mix/#{release}/"
54+
]
55+
end
56+
57+
# scraping of older versions is no longer supported!
58+
3659
version '1.15' do
3760
self.release = '1.15.4'
3861
self.base_urls = [

0 commit comments

Comments
 (0)