Skip to content

Commit 5e973d8

Browse files
authored
Merge branch 'freeCodeCamp:main' into master
2 parents 7c5132a + 1ee7402 commit 5e973d8

35 files changed

+332
-123
lines changed

Gemfile.lock

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ GEM
5656
logger (1.6.1)
5757
method_source (1.0.0)
5858
mini_portile2 (2.8.7)
59-
minitest (5.25.1)
59+
minitest (5.25.2)
6060
multi_json (1.15.0)
61-
mustermann (3.0.0)
61+
mustermann (3.0.3)
6262
ruby2_keywords (~> 0.0.1)
6363
newrelic_rpm (8.16.0)
6464
nokogiri (1.16.7)
@@ -88,8 +88,7 @@ GEM
8888
rb-inotify (0.10.1)
8989
ffi (~> 1.0)
9090
redcarpet (3.6.0)
91-
rexml (3.2.9)
92-
strscan
91+
rexml (3.3.9)
9392
rouge (1.11.1)
9493
rr (3.1.1)
9594
rss (0.3.1)
@@ -125,7 +124,6 @@ GEM
125124
unicode-display_width (>= 1.5, < 3.0)
126125
unicode_utils (~> 1.4)
127126
strings-ansi (0.2.0)
128-
strscan (1.0.3)
129127
terminal-table (3.0.2)
130128
unicode-display_width (>= 1.1.1, < 3)
131129
terser (1.2.4)
@@ -135,7 +133,7 @@ GEM
135133
eventmachine (~> 1.0, >= 1.0.4)
136134
rack (>= 1, < 3)
137135
thor (1.3.2)
138-
tilt (2.3.0)
136+
tilt (2.4.0)
139137
tty-pager (0.14.0)
140138
strings (~> 0.2.0)
141139
tty-screen (~> 0.8)

assets/javascripts/news.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[
2+
[
3+
"2024-11-23",
4+
"New documentation: <a href=\"/duckdb/\">DuckDB</a>"
5+
],
26
[
37
"2024-08-20",
48
"New documentation: <a href=\"/man/\">Linux man pages</a>"

assets/javascripts/templates/pages/help_tmpl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ app.templates.helpPage = function () {
33
const navKey = $.isMac() ? "cmd" : "alt";
44
const arrowScroll = app.settings.get("arrowScroll");
55

6-
const aliases = Object.entries(app.models.Entry.ALIASES);
6+
const aliases = Object.entries(app.config.docs_aliases);
77
const middle = Math.ceil(aliases.length / 2);
88
const aliases_one = aliases.slice(0, middle);
99
const aliases_two = aliases.slice(middle);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
module Docs
4+
class Duckdb
5+
class AttributionFilter < Docs::AttributionFilter
6+
def attribution_link
7+
url = current_url.to_s.sub! 'http://localhost:8000', 'https://duckdb.org'
8+
%(<a href="#{url}" class="_attribution-link">#{url}</a>)
9+
end
10+
end
11+
end
12+
end

lib/docs/filters/duckdb/clean_html.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module Docs
2+
class Duckdb
3+
class CleanHtmlFilter < Filter
4+
def call
5+
# First extract the main content
6+
@doc = at_css('#main_content_wrap', 'main')
7+
return doc if @doc.nil?
8+
9+
doc.prepend_child at_css('.title').remove
10+
at_css('.title').name = 'h1'
11+
12+
# Remove navigation and header elements
13+
css('.headerline', '.headlinebar', '.landingmenu', '.search_icon', '#sidebar', '.pagemeta', '.toc_menu', '.section-nav').remove
14+
15+
# Clean up code blocks
16+
css('div.highlighter-rouge').each do |node|
17+
node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
18+
node.content = node.content.strip
19+
node.name = 'pre'
20+
end
21+
22+
# Remove unnecessary attributes
23+
css('div, span, p').each do |node|
24+
node.remove_attribute('style')
25+
node.remove_attribute('class')
26+
end
27+
28+
# Remove empty elements
29+
css('div, span').each do |node|
30+
node.remove if node.content.strip.empty?
31+
end
32+
33+
# Remove script tags
34+
css('script').remove
35+
36+
doc
37+
end
38+
end
39+
end
40+
end

lib/docs/filters/duckdb/entries.rb

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module Docs
2+
class Duckdb
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
at_css('h1', '.title').content
6+
end
7+
8+
def get_type
9+
case subpath
10+
when /\Asql\//
11+
'SQL Reference'
12+
when /\Aapi\//
13+
'Client APIs'
14+
when /\Aguides\//
15+
'How-to Guides'
16+
when /\Adata\//
17+
'Data Import'
18+
when /\Aoperations_manual\//
19+
'Operations Manual'
20+
when /\Adev\//
21+
'Development'
22+
when /\Ainternals\//
23+
'Internals'
24+
when /\Aextensions\//
25+
'Extensions'
26+
when /\Aarchive\//
27+
'Archive'
28+
else
29+
'Documentation'
30+
end
31+
end
32+
33+
def additional_entries
34+
entries = []
35+
css('h2[id]', 'h3[id]').each do |node|
36+
name = node.content.strip
37+
# Clean up the name
38+
name = name.gsub(/[\r\n\t]/, ' ').squeeze(' ')
39+
entries << [name, node['id'], get_type]
40+
end
41+
entries
42+
end
43+
end
44+
end
45+
end

lib/docs/filters/eslint/clean_html.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def call
55
@doc = at_css('#main') if at_css('#main')
66
@doc = at_css('.docs-main__content') if at_css('.docs-main__content')
77

8+
css('.docs-toc').remove
89
css('.eslint-ad').remove
910
css('.glyphicon').remove
1011
css('hr', 'colgroup', 'td:empty').remove

lib/docs/filters/eslint/entries.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ def get_type
1010
if subpath.start_with?('rules')
1111
return 'Rules'
1212
else
13-
at_css('nav.docs-index [aria-current="true"]').ancestors('li')[-1].at_css('a').content
13+
type = at_css('nav.docs-index [aria-current="true"]').ancestors('li')[-1].at_css('a').content
14+
# This specific entry is mispelled with a lowercase 'i'
15+
if type.start_with?('integrate')
16+
type = type.sub('integrate', 'Integrate')
17+
end
18+
return type
1419
end
1520
end
1621
end

lib/docs/filters/sequelize/clean_html.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Docs
22
class Sequelize
33
class CleanHtmlFilter < Filter
44
def call
5-
@doc = at_css('article', '.content')
5+
@doc = at_css('article', '.content .self-detail', '.content')
66

77
if at_css('header > h1')
88
# Pull the header out of its container

lib/docs/filters/svelte/clean_html.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@ module Docs
22
class Svelte
33
class CleanHtmlFilter < Filter
44
def call
5-
@doc = at_css('main .page.content')
5+
@doc = at_css('main .page.content #docs-content')
6+
7+
# Remove title header
8+
at_css('> header > div.breadcrumbs').remove()
9+
# Remove extra input toggle
10+
at_css('> aside.on-this-page input').remove()
11+
# Remove "edit this page" link
12+
at_css('> p.edit').remove()
13+
# Remove footer navigation
14+
at_css('> div.controls').remove()
15+
616
at_css('h1').content = 'Svelte' if root_page?
717
css('pre').each do |node|
18+
# Remove hover popup
19+
node.css('.twoslash-popup-container').remove()
820
node.content = node.css('.line').map(&:content).join("\n")
9-
node['data-language'] = 'javascript'
21+
node['data-language'] = 'typescript'
1022
end
1123
doc
1224
end

0 commit comments

Comments
 (0)