Unified · Split
| @@ -9,6 +9,7 @@ module Docs · 8 unmodified lines | |||
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | def call | 11 | def call |
| 12 | @doc = at_css('main') | ||
| 12 | root_page? ? root : other | 13 | root_page? ? root : other |
| 13 | doc | 14 | doc |
| 14 | end | 15 | end |
| @@ -17,6 +18,9 @@ module Docs · 2 unmodified lines | |||
| 17 | header = at_css('h1') | 18 | header = at_css('h1') |
| 18 | header.parent.before(header).remove | 19 | header.parent.before(header).remove |
| 19 | 20 | ||
| 21 | # css('#above-the-fold-headline-code').remove | ||
| 22 | # css('#adopt-gradually-content').remove | ||
| 23 | |||
| 20 | css('h4').each do |node| | 24 | css('h4').each do |node| |
| 21 | node.name = 'h2' | 25 | node.name = 'h2' |
| 22 | end | 26 | end |
| @@ -21,8 +21,15 @@ module Docs · 20 unmodified lines | |||
| 21 | def get_type | 21 | def get_type |
| 22 | if DEPRECATED_PAGES.include? slug | 22 | if DEPRECATED_PAGES.include? slug |
| 23 | 'Handbook (deprecated)' | 23 | 'Handbook (deprecated)' |
| 24 | elsif slug.include?('declaration-files') | ||
| 25 | 'Declaration Files' | ||
| 26 | elsif slug == 'download' | ||
| 27 | 'Handbook' | ||
| 28 | elsif slug == 'why-create-typescript' | ||
| 29 | 'Handbook' | ||
| 24 | else | 30 | else |
| 25 | name | 31 | button = at_css('nav#sidebar > ul > li.open.highlighted > button') |
| 32 | button ? button.content : name | ||
| 26 | end | 33 | end |
| 27 | end | 34 | end |
| 28 | 35 | ||
| @@ -39,7 +46,7 @@ module Docs · 10 unmodified lines | |||
| 39 | end | 46 | end |
| 40 | 47 | ||
| 41 | def handbook_entries | 48 | def handbook_entries |
| 42 | css('h2').each_with_object [] do |node, entries| | 49 | css('h2', 'h3:has(code)').each_with_object [] do |node, entries| |
| 43 | entries << ["#{name}: #{node.content}", node['id']] if node['id'] | 50 | entries << ["#{name}: #{node.content}", node['id']] if node['id'] |
| 44 | end | 51 | end |
| 45 | end | 52 | end |
| @@ -4,12 +4,14 @@ module Docs · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | self.name = 'TypeScript' | 5 | self.name = 'TypeScript' |
| 6 | self.type = 'typescript' | 6 | self.type = 'typescript' |
| 7 | self.release = '5.1.3' | 7 | self.release = '5.3.3' |
| 8 | self.base_urls = [ | 8 | self.base_urls = [ |
| 9 | 'https://www.typescriptlang.org/docs/handbook/', | 9 | 'https://www.typescriptlang.org/docs/handbook/', |
| 10 | 'https://www.typescriptlang.org/' | 10 | 'https://www.typescriptlang.org/' |
| 11 | ] | 11 | ] |
| 12 | 12 | ||
| 13 | self.root_path = 'docs/' | ||
| 14 | |||
| 13 | def initial_urls | 15 | def initial_urls |
| 14 | [ 'https://www.typescriptlang.org/docs/handbook/', | 16 | [ 'https://www.typescriptlang.org/docs/handbook/', |
| 15 | 'https://www.typescriptlang.org/tsconfig' ] | 17 | 'https://www.typescriptlang.org/tsconfig' ] |
| @@ -22,16 +24,24 @@ module Docs · 6 unmodified lines | |||
| 22 | 24 | ||
| 23 | html_filters.push 'typescript/entries', 'typescript/clean_html', 'title' | 25 | html_filters.push 'typescript/entries', 'typescript/clean_html', 'title' |
| 24 | 26 | ||
| 25 | options[:container] = 'main' | 27 | options[:fix_urls_before_parse] = ->(url) do |
| 28 | url.sub! '/docs/handbook/esm-node.html', '/docs/handbook/modules/reference.html#node16-nodenext' | ||
| 29 | url.sub! '/docs/handbook/modules.html', '/docs/handbook/modules/introduction.html' | ||
| 30 | url | ||
| 31 | end | ||
| 26 | 32 | ||
| 27 | options[:skip] = [ | 33 | options[:skip] = [ |
| 28 | 'react-&-webpack.html' | 34 | 'react-&-webpack.html' |
| 29 | ] | 35 | ] |
| 30 | 36 | ||
| 31 | options[:skip_patterns] = [ | 37 | options[:skip_patterns] = [ |
| 38 | /\Abranding/, | ||
| 39 | /\Acommunity/, | ||
| 40 | /\Adocs\Z/, | ||
| 41 | /\Atools/, | ||
| 32 | /release-notes/, | 42 | /release-notes/, |
| 33 | /dt\/search/, | 43 | /dt\/search/, |
| 34 | /play\// | 44 | /play/ |
| 35 | ] | 45 | ] |
| 36 | 46 | ||
| 37 | options[:attribution] = <<-HTML | 47 | options[:attribution] = <<-HTML |