updated deno version

pull/2372/head
Rui Jiang 2 months ago
parent c07ccf542e
commit 0733738b00

@ -2,26 +2,22 @@ module Docs
class Deno
class CleanHtmlFilter < Filter
def call
if root_page?
@doc = at_css('h2[id]').parent.parent
if result[:path].start_with?('api/deno/')
@doc = at_css('main')
else
@doc = at_css('article')
@doc = at_css('main article .markdown-body')
end
css('*[aria-label="Anchor"]').remove
css('pre', '.tw-1nkr705').each do |node|
node['data-language'] = 'typescript'
node.name = 'pre'
css('code').each do |node|
if node['class']
lang = node['class'][/language-(\w+)/, 1]
end
node['data-language'] = lang || 'ts'
node.remove_attribute('class')
end
css('.tw-8ej7ai').each do |node|
code = node.at_css('.font-mono')
next unless code
code.parent.name = 'blockquote'
code.name = 'code'
end
css('*[class]').remove_attribute('class')
xpath('//a[text()="[src]"]').remove
css('a.header-anchor').remove()
doc
end
end

@ -3,11 +3,21 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').content
if result[:path].start_with?('api/deno/')
at_css('main')['id'][/\Asymbol_([.\w]+)/, 1]
else
at_css('main article h1').content
end
end
def get_type
'Deno CLI APIs'
if result[:path].start_with?('api/deno/')
'API'
elsif result[:path].start_with?('runtime/reference/cli')
'CLI'
else
at_css('main article nav ul :first span').content
end
end
end

@ -2,22 +2,40 @@ module Docs
class Deno < UrlScraper
self.name = 'Deno'
self.type = 'simple'
self.release = '1.27.0'
self.base_url = 'https://doc.deno.land/deno/stable/'
self.links = {
home: 'https://deno.land/',
home: 'https://deno.com/',
code: 'https://github.com/denoland/deno'
}
html_filters.push 'deno/entries', 'deno/clean_html'
# https://github.com/denoland/manual/blob/main/LICENSE
options[:attribution] = <<-HTML
&copy; 20182022 the Deno authors
&copy; 20182024 the Deno authors<br>
Licensed under the MIT License.
HTML
html_filters.push 'deno/entries', 'deno/clean_html'
version '2' do
self.release = '2.1.1'
self.base_url = 'https://docs.deno.com/'
self.root_path = 'runtime'
options[:only_patterns] = [/\Aruntime/, /\Aapi\/deno\/~/, /\Adeploy/, /\Asubhosting/]
options[:skip_patterns] = [
/\Aruntime\/manual/,
/\Aapi\/deno\/.+\.prototype\z/, # all prototype pages get redirected to the main page
/\Aapi\/deno\/~\/Deno\.jupyter\.MediaBundle.+/, # docs unavailable
/\Aapi\/deno\/~\/Deno\.OpMetrics/, # deprecated in deno 2
]
options[:trailing_slash] = false
end
version '1' do
self.release = '1.27.0'
end
def get_latest_version(opts)
get_latest_github_release('denoland', 'deno', opts)
end
end
end
end

Loading…
Cancel
Save