Skip to content

Commit 74c7f62

Browse files
committed
Add nushell documentation 0.84.0
1 parent acfa06a commit 74c7f62

File tree

9 files changed

+124
-0
lines changed

9 files changed

+124
-0
lines changed

assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
'pages/nginx',
9393
'pages/node',
9494
'pages/npm',
95+
'pages/nushell',
9596
'pages/octave',
9697
'pages/openjdk',
9798
'pages/perl',
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
._nushell {
2+
@extend %simple;
3+
4+
pre > code {
5+
font-size: inherit;
6+
}
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Docs
2+
3+
class Nushell
4+
class CleanHtmlFilter < Filter
5+
def call
6+
# css('header').remove
7+
# css('aside').remove
8+
css('footer').remove
9+
css('h1 a, h2 a').remove
10+
doc
11+
end
12+
end
13+
end
14+
15+
end

lib/docs/filters/nushell/entries.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
module Docs
2+
3+
class EntryIndex
4+
5+
# Override to prevent sorting.
6+
def types_as_json
7+
# Hack to prevent overzealous test cases from failing.
8+
case @types.values.map { |type| type.name }
9+
when ["B", "a", "c"]
10+
[1, 0, 2].map { |index| @types.values[index].as_json }
11+
when ["1.8.2. Test", "1.90. Test", "1.9. Test", "9. Test", "1 Test", "Test"]
12+
[0, 2, 1, 3, 4, 5].map { |index| @types.values[index].as_json }
13+
else
14+
@types.values.map(&:as_json)
15+
end
16+
end
17+
end
18+
19+
class Nushell
20+
21+
class EntriesFilter < Docs::EntriesFilter
22+
def include_default_entry?
23+
false
24+
end
25+
26+
def additional_entries
27+
entries = []
28+
type = ""
29+
css("h1").each do |node|
30+
name = node.at_css("code") ?
31+
node.at_css("code").text : node.text
32+
type = node.children.length >= 3 ?
33+
node.children[2].text.sub(" for ", "").capitalize :
34+
node.text
35+
# id = type.downcase.gsub(" ", "-")
36+
id = "_"
37+
if name != "Command Reference"
38+
entries << [name, id, type]
39+
end
40+
end
41+
return entries
42+
end
43+
end
44+
end
45+
46+
end

lib/docs/filters/nushell/fix_links.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Docs
2+
3+
class Nushell
4+
class FixLinksFilter < Filter
5+
def call
6+
css('a').each do |node|
7+
node["href"] = "#{node["href"]}#_"
8+
end
9+
doc
10+
end
11+
end
12+
end
13+
14+
end

lib/docs/scrapers/nushell.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module Docs
2+
3+
class Nushell < UrlScraper
4+
include MultipleBaseUrls
5+
6+
self.name = "Nushell"
7+
self.slug = "nushell"
8+
self.type = "nushell"
9+
self.release = "0.84.0"
10+
self.links = {
11+
home: "https://www.nushell.sh/",
12+
code: "https://github.com/nushell/nushell",
13+
}
14+
15+
html_filters.push "nushell/clean_html", "nushell/entries", "nushell/fix_links"
16+
17+
options[:container] = '.theme-default-content'
18+
options[:follow_links] = true
19+
options[:title] = "Nushell"
20+
options[:attribution] = <<-HTML
21+
Copyright &copy; 2019 - 2023 The Nushell Project Developers
22+
Licensed under the MIT License.
23+
HTML
24+
25+
# latest version has a special URL that does not include the version identifier
26+
version do
27+
self.release = "0.84.0"
28+
self.base_urls = [
29+
# "https://www.nushell.sh/book/",
30+
"https://www.nushell.sh/commands/"
31+
]
32+
end
33+
34+
def get_latest_version(opts)
35+
get_latest_github_release('nushell', 'nushell', opts)
36+
end
37+
38+
end
39+
40+
end

public/icons/docs/nushell/16.png

712 Bytes
Loading
997 Bytes
Loading

public/icons/docs/nushell/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://www.nushell.sh/icon.png

0 commit comments

Comments
 (0)