Update TypeScript documentation (5.3.3)

pull/2111/head
Simon Legner 1 year ago
parent 53a96537c7
commit ddfeed42db

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

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

@ -4,12 +4,14 @@ module Docs
self.name = 'TypeScript' self.name = 'TypeScript'
self.type = 'typescript' self.type = 'typescript'
self.release = '5.1.3' self.release = '5.3.3'
self.base_urls = [ self.base_urls = [
'https://www.typescriptlang.org/docs/handbook/', 'https://www.typescriptlang.org/docs/handbook/',
'https://www.typescriptlang.org/' 'https://www.typescriptlang.org/'
] ]
self.root_path = 'docs/'
def initial_urls def initial_urls
[ 'https://www.typescriptlang.org/docs/handbook/', [ 'https://www.typescriptlang.org/docs/handbook/',
'https://www.typescriptlang.org/tsconfig' ] 'https://www.typescriptlang.org/tsconfig' ]
@ -22,16 +24,24 @@ module Docs
html_filters.push 'typescript/entries', 'typescript/clean_html', 'title' 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] = [ options[:skip] = [
'react-&-webpack.html' 'react-&-webpack.html'
] ]
options[:skip_patterns] = [ options[:skip_patterns] = [
/\Abranding/,
/\Acommunity/,
/\Adocs\Z/,
/\Atools/,
/release-notes/, /release-notes/,
/dt\/search/, /dt\/search/,
/play\// /play/
] ]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML

Loading…
Cancel
Save