Update TypeScript documentation (5.3.3)

This commit is contained in:
Simon Legner 2024-01-07 10:25:07 +01:00
parent 53a96537c7
commit ddfeed42db
3 changed files with 26 additions and 5 deletions

View file

@ -9,6 +9,7 @@ module Docs
}
def call
@doc = at_css('main')
root_page? ? root : other
doc
end
@ -17,6 +18,9 @@ module Docs
header = at_css('h1')
header.parent.before(header).remove
# css('#above-the-fold-headline-code').remove
# css('#adopt-gradually-content').remove
css('h4').each do |node|
node.name = 'h2'
end

View file

@ -21,8 +21,15 @@ module Docs
def get_type
if DEPRECATED_PAGES.include? slug
'Handbook (deprecated)'
elsif slug.include?('declaration-files')
'Declaration Files'
elsif slug == 'download'
'Handbook'
elsif slug == 'why-create-typescript'
'Handbook'
else
name
button = at_css('nav#sidebar > ul > li.open.highlighted > button')
button ? button.content : name
end
end
@ -39,7 +46,7 @@ module Docs
end
def handbook_entries
css('h2').each_with_object [] do |node, entries|
css('h2', 'h3:has(code)').each_with_object [] do |node, entries|
entries << ["#{name}: #{node.content}", node['id']] if node['id']
end
end

View file

@ -4,12 +4,14 @@ module Docs
self.name = 'TypeScript'
self.type = 'typescript'
self.release = '5.1.3'
self.release = '5.3.3'
self.base_urls = [
'https://www.typescriptlang.org/docs/handbook/',
'https://www.typescriptlang.org/'
]
self.root_path = 'docs/'
def initial_urls
[ 'https://www.typescriptlang.org/docs/handbook/',
'https://www.typescriptlang.org/tsconfig' ]
@ -22,16 +24,24 @@ module Docs
html_filters.push 'typescript/entries', 'typescript/clean_html', 'title'
options[:container] = 'main'
options[:fix_urls_before_parse] = ->(url) do
url.sub! '/docs/handbook/esm-node.html', '/docs/handbook/modules/reference.html#node16-nodenext'
url.sub! '/docs/handbook/modules.html', '/docs/handbook/modules/introduction.html'
url
end
options[:skip] = [
'react-&-webpack.html'
]
options[:skip_patterns] = [
/\Abranding/,
/\Acommunity/,
/\Adocs\Z/,
/\Atools/,
/release-notes/,
/dt\/search/,
/play\//
/play/
]
options[:attribution] = <<-HTML