Simon Legner 4 years ago
parent e9d7849412
commit 91138ad508

@ -116,6 +116,7 @@
'pages/tcl_tk', 'pages/tcl_tk',
'pages/tensorflow', 'pages/tensorflow',
'pages/terraform', 'pages/terraform',
'pages/typescript',
'pages/underscore', 'pages/underscore',
'pages/vue', 'pages/vue',
'pages/webpack', 'pages/webpack',

@ -0,0 +1,4 @@
._typescript {
@extend %simple;
.deprecated { @extend %label-red; }
}

@ -24,7 +24,11 @@ module Docs
def other def other
if base_url.path == '/docs/handbook/' if base_url.path == '/docs/handbook/'
deprecated = at_css('#deprecated-content')
deprecated.css('h3', '#deprecated-icon').remove if deprecated
deprecated.add_class('deprecated') if deprecated
@doc = at_css('article > .whitespace > .markdown') @doc = at_css('article > .whitespace > .markdown')
doc.child.before(deprecated) if deprecated
else # tsconfig page else # tsconfig page
@doc = at_css('.markdown > div') @doc = at_css('.markdown > div')
@ -36,9 +40,14 @@ module Docs
css('pre').each do |node| css('pre').each do |node|
language = node.at_css('.language-id') ? node.at_css('.language-id').content : 'typescript' language = node.at_css('.language-id') ? node.at_css('.language-id').content : 'typescript'
node.css('.language-id').remove node.css('.language-id').remove
if node.at_css('.line').nil?
node.content = node.content node.content = node.content
else
node.content = node.css('.line').map(&:content).join("\n")
end
node['data-language'] = LANGUAGE_REPLACE[language] || language node['data-language'] = LANGUAGE_REPLACE[language] || language
node.remove_attribute('class') node.remove_attribute('class')
node.remove_attribute('style')
end end
end end

@ -2,15 +2,31 @@ module Docs
class Typescript class Typescript
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
DEPRECATED_PAGES = %w(
advanced-types
basic-types
classes
functions
generics
interfaces
literal-types
unions-and-intersections
)
def get_name def get_name
at_css('h1') ? at_css('h1').content : at_css('h2').content at_css('h1') ? at_css('h1').content : at_css('h2').content
end end
def get_type def get_type
if DEPRECATED_PAGES.include? slug
'Handbook (deprecated)'
else
name name
end end
end
def additional_entries def additional_entries
return [] if DEPRECATED_PAGES.include? slug
base_url.path == '/' ? tsconfig_entries : handbook_entries base_url.path == '/' ? tsconfig_entries : handbook_entries
end end

@ -3,8 +3,8 @@ module Docs
include MultipleBaseUrls include MultipleBaseUrls
self.name = 'TypeScript' self.name = 'TypeScript'
self.type = 'simple' self.type = 'typescript'
self.release = '4.2.2' self.release = '4.2.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/'
@ -29,7 +29,6 @@ module Docs
] ]
options[:skip_patterns] = [ options[:skip_patterns] = [
/2/,
/release-notes/, /release-notes/,
/play\// /play\//
] ]

Loading…
Cancel
Save