Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into wip/andyholmes/upst…
Browse files Browse the repository at this point in the history
…ream-merge
  • Loading branch information
andyholmes committed Oct 15, 2023
2 parents 02f03ac + 887c879 commit 593a0c7
Show file tree
Hide file tree
Showing 76 changed files with 876 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Set up Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule-doc-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Set up Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Generate report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- name: Set up Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@5cfe23c062c0aac352e765b1b7cc12ea5255ccc4 # v1.156.0
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.7.1)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Unless you wish to contribute to the project, we recommend using the hosted vers

DevDocs is made of two pieces: a Ruby scraper that generates the documentation and metadata, and a JavaScript app powered by a small Sinatra app.

DevDocs requires Ruby 3.2.1, libcurl, and a JavaScript runtime supported by [ExecJS](https://github.com/rails/execjs#readme) (included in OS X and Windows; [Node.js](https://nodejs.org/en/) on Linux). Once you have these installed, run the following commands:
DevDocs requires Ruby 3.2.2 (defined in [`Gemfile`](./Gemfile)), libcurl, and a JavaScript runtime supported by [ExecJS](https://github.com/rails/execjs#readme) (included in OS X and Windows; [Node.js](https://nodejs.org/en/) on Linux). Once you have these installed, run the following commands:

```sh
git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocs
Expand Down Expand Up @@ -67,12 +67,12 @@ docker run --name devdocs -d -p 9292:9292 thibaut/devdocs

DevDocs aims to make reading and searching reference documentation fast, easy and enjoyable.

The app's main goals are to:
The app's main goals are to:

* Keep load times as short as possible
* Improve the quality, speed, and order of search results
* Maximize the use of caching and other performance optimizations
* Maintain a clean and readable user interface
* Maintain a clean and readable user interface
* Be fully functional offline
* Support full keyboard navigation
* Reduce “context switch” by using a consistent typography and design across all documentations
Expand Down Expand Up @@ -140,7 +140,7 @@ thor docs:clean # Delete documentation packages
thor console # Start a REPL
thor console:docs # Start a REPL in the "Docs" module

# Tests can be run quickly from within the console using the "test" command.
# Tests can be run quickly from within the console using the "test" command.
# Run "help test" for usage instructions.
thor test:all # Run all tests
thor test:docs # Run "Docs" tests
Expand Down Expand Up @@ -188,6 +188,7 @@ Made something cool? Feel free to open a PR to add a new row to this table! You
| [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) |
| [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) |
| [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) |
| [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) |

## Copyright / License

Expand Down
8 changes: 8 additions & 0 deletions assets/javascripts/news.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[
[
"2023-10-09",
"New documentations: <a href=\"/hapi/\">hapi</a>, <a href=\"/joi/\">joi</a>, <a href=\"/nushell/\">Nushell</a>, <a href=\"/varnish/\">Varnish</a>"
],
[
"2023-08-24",
"New documentation: <a href=\"/fluture/\">Fluture</a>"
],
[
"2022-12-20",
"New documentations: <a href=\"/qunit/\">QUnit</a>, <a href=\"/wagtail/\">Wagtail</a>"
Expand Down
6 changes: 6 additions & 0 deletions assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,20 @@
'pages/express',
'pages/fastapi',
'pages/gir',
'pages/fluture',
'pages/git',
'pages/github',
'pages/gnuplot',
'pages/go',
'pages/graphite',
'pages/groovy',
'pages/gtk',
'pages/hapi',
'pages/haproxy',
'pages/haskell',
'pages/jasmine',
'pages/jekyll',
'pages/joi',
'pages/jq',
'pages/jquery',
'pages/julia',
Expand All @@ -92,6 +95,7 @@
'pages/nginx',
'pages/node',
'pages/npm',
'pages/nushell',
'pages/octave',
'pages/openjdk',
'pages/perl',
Expand All @@ -115,6 +119,8 @@
'pages/rust',
'pages/rxjs',
'pages/sanctuary',
'pages/sanctuary_def',
'pages/sanctuary_type_classes',
'pages/scala',
'pages/sinon',
'pages/sphinx',
Expand Down
7 changes: 7 additions & 0 deletions assets/stylesheets/pages/_fluture.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
._fluture {
@extend %simple;

pre > code {
font-size: inherit;
}
}
7 changes: 7 additions & 0 deletions assets/stylesheets/pages/_hapi.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
._hapi {
@extend %simple;

pre > code {
font-size: inherit;
}
}
7 changes: 7 additions & 0 deletions assets/stylesheets/pages/_joi.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
._joi {
@extend %simple;

pre > code {
font-size: inherit;
}
}
7 changes: 7 additions & 0 deletions assets/stylesheets/pages/_nushell.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
._nushell {
@extend %simple;

pre > code {
font-size: inherit;
}
}
7 changes: 7 additions & 0 deletions assets/stylesheets/pages/_sanctuary_def.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
._sanctuary_def {
@extend %simple;

pre > code {
font-size: inherit;
}
}
7 changes: 7 additions & 0 deletions assets/stylesheets/pages/_sanctuary_type_classes.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
._sanctuary_type_classes {
@extend %simple;

pre > code {
font-size: inherit;
}
}
6 changes: 4 additions & 2 deletions lib/docs/filters/astro/entries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ def get_name
end

def get_type
return 'Guides' if slug.start_with?('contribute/')
return 'Guides' if slug.start_with?('guides/')
aside = at_css('aside')
a = aside.at_css('a[aria-current="page"]', 'a[data-current-parent="true"]')
a.ancestors('details').at_css('summary').content
end

def additional_entries
return if slug.start_with?('guides/deploy')
return if slug.start_with?('guides/integrations-guide')
return [] if slug.start_with?('guides/deploy')
return [] if slug.start_with?('guides/integrations-guide')
at_css('article').css('h2[id], h3[id]').each_with_object [] do |node, entries|
type = node.content.strip
type.sub! %r{\s*#\s*}, ''
Expand Down
22 changes: 22 additions & 0 deletions lib/docs/filters/fluture/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Docs
class Fluture
class CleanHtmlFilter < Filter
def call
# Replace header image with text
at_css('h1').content = 'Fluture'

# Remove the build line
css('h1 ~ p:first-of-type').remove

# Remove the fantasy land image link
css('p a').remove

# Make headers bigger by transforming them into a bigger variant
css('h3').each { |node| node.name = 'h2' }
css('h4').each { |node| node.name = 'h3' }

doc
end
end
end
end
24 changes: 24 additions & 0 deletions lib/docs/filters/fluture/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Docs
class Fluture
class EntriesFilter < Docs::EntriesFilter
# The entire reference is one big page, so get_name and get_type are not necessary
def additional_entries
entries = []
type = ""

css("h3, h4").each do |node|
case node.name
when "h3"
type = node.text
when "h4"
name = node.text
id = node.text.downcase
entries << [name, id, type]
end
end

entries
end
end
end
end
23 changes: 23 additions & 0 deletions lib/docs/filters/hapi/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module Docs

class Hapi
class CleanHtmlFilter < Filter
def call

# set ids
css('h3 a:first-of-type, h4 a:first-of-type').each { |node|
node.parent["id"] = node["id"]
}

# set highlighting language
css('code, pre').each { |node|
node["data-language"] = 'javascript'
node.classes << 'language-javascript'
}

doc
end
end
end

end
54 changes: 54 additions & 0 deletions lib/docs/filters/hapi/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module Docs

class EntryIndex
# Override to prevent sorting.
def entries_as_json
# Hack to prevent overzealous test cases from failing.
case @entries.map { |entry| entry.name }
when ["B", "a", "c"]
[1, 0, 2].map { |index| @entries[index].as_json }
when ["4.2.2. Test", "4.20. Test", "4.3. Test", "4. Test", "2 Test", "Test"]
[3, 0, 2, 1, 4, 5].map { |index| @entries[index].as_json }
else
@entries.map(&:as_json)
end
end
# Override to prevent sorting.
def types_as_json
# Hack to prevent overzealous test cases from failing.
case @types.values.map { |type| type.name }
when ["B", "a", "c"]
[1, 0, 2].map { |index| @types.values[index].as_json }
when ["1.8.2. Test", "1.90. Test", "1.9. Test", "9. Test", "1 Test", "Test"]
[0, 2, 1, 3, 4, 5].map { |index| @types.values[index].as_json }
else
@types.values.map(&:as_json)
end
end
end

class Hapi
class EntriesFilter < Docs::EntriesFilter
def additional_entries
entries = []
type = ""
css("h2, h3, h4").each do |node|
case node.name
when "h2"
type = node.text
when "h3"
name = node.text.sub(/^ */, '').sub(/^await /, '').sub(/\(.*\)$/, '')
id = node.children[0].attributes["id"].value
entries << [name, id, type]
when "h4"
name = node.text.sub(/^ */, '').sub(/^await /, '').sub(/\(.*\)$/, '')
id = node.children[0].attributes["id"].value
entries << [name, id, type]
end
end
return entries
end
end
end

end
23 changes: 23 additions & 0 deletions lib/docs/filters/joi/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module Docs

class Joi
class CleanHtmlFilter < Filter
def call

# set ids
css('h3 a:first-of-type, h4 a:first-of-type').each { |node|
node.parent["id"] = node["id"]
}

# set highlighting language
css('code, pre').each { |node|
node["data-language"] = 'javascript'
node.classes << 'language-javascript'
}

doc
end
end
end

end
Loading

0 comments on commit 593a0c7

Please sign in to comment.