Skip to content

Commit 278cec6

Browse files
committed
Update Nushell documentation (0.113.1)
1 parent 83292c2 commit 278cec6

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

lib/docs/filters/nushell/clean_html.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ module Docs
33
class Nushell
44
class CleanHtmlFilter < Filter
55
def call
6-
@doc = at_css('.theme-default-content > div:only-child', '.theme-default-content')
76
css('footer').remove
8-
css('h1 a, h2 a').remove
7+
8+
css('span.lang').remove
9+
10+
css('h1 > a').each do |node|
11+
node.before(node.children).remove
12+
end
13+
14+
css('pre > code:first-child').each do |node|
15+
node.parent['data-language'] = 'sh'
16+
node.parent.content = node.css('.line').map(&:content).join("\n")
17+
end
18+
919
doc
1020
end
1121
end

lib/docs/filters/nushell/entries.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def include_default_entry?
2323
false
2424
end
2525

26+
def get_name
27+
name = at_css('h1').content
28+
name
29+
end
30+
2631
def additional_entries
2732
entries = []
2833
type = ""
@@ -38,6 +43,7 @@ def additional_entries
3843
css("h1").each do |node|
3944
name = node.at_css("code") ?
4045
node.at_css("code").text : node.text
46+
node = node.at_css('> span') if node.at_css('> span')
4147
type = node.children.length >= 3 ?
4248
node.children[2].text.sub(" for ", "").capitalize :
4349
node.text

lib/docs/scrapers/nushell.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ class Nushell < UrlScraper
66
self.name = "Nushell"
77
self.slug = "nushell"
88
self.type = "nushell"
9-
self.release = "0.85.0"
9+
self.release = "0.113.1"
1010
self.links = {
1111
home: "https://www.nushell.sh/",
1212
code: "https://github.com/nushell/nushell",
1313
}
1414

1515
html_filters.push "nushell/clean_html", "nushell/entries", "nushell/fix_links"
1616

17-
options[:container] = '.theme-container'
17+
options[:container] = 'main > [vp-content]'
1818
options[:follow_links] = true
1919
options[:title] = "Nushell"
2020
options[:attribution] = <<-HTML
21-
Copyright &copy; 2019–2023 The Nushell Project Developers
21+
Copyright &copy; 2019–2026 The Nushell Project Developers
2222
Licensed under the MIT License.
2323
HTML
2424

0 commit comments

Comments
 (0)