updated deno version

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

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

@ -3,11 +3,21 @@ module Docs
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name 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 end
def get_type 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
end end

@ -2,22 +2,40 @@ module Docs
class Deno < UrlScraper class Deno < UrlScraper
self.name = 'Deno' self.name = 'Deno'
self.type = 'simple' self.type = 'simple'
self.release = '1.27.0'
self.base_url = 'https://doc.deno.land/deno/stable/'
self.links = { self.links = {
home: 'https://deno.land/', home: 'https://deno.com/',
code: 'https://github.com/denoland/deno' code: 'https://github.com/denoland/deno'
} }
html_filters.push 'deno/entries', 'deno/clean_html'
# https://github.com/denoland/manual/blob/main/LICENSE # https://github.com/denoland/manual/blob/main/LICENSE
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 20182022 the Deno authors &copy; 20182024 the Deno authors<br>
Licensed under the MIT License.
HTML 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) def get_latest_version(opts)
get_latest_github_release('denoland', 'deno', opts) get_latest_github_release('denoland', 'deno', opts)
end end
end end
end end

Loading…
Cancel
Save