[devdocsgjs/main: 1549/1867] Update TypeScript documentation (New Handbook)
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1549/1867] Update TypeScript documentation (New Handbook)
- Date: Fri, 19 Nov 2021 23:48:08 +0000 (UTC)
commit 91138ad50894e0ba2159bf7f0192f33ae426d83f
Author: Simon Legner <Simon Legner gmail com>
Date: Sat Mar 6 00:37:42 2021 +0100
Update TypeScript documentation (New Handbook)
https://devblogs.microsoft.com/typescript/announcing-the-new-typescript-handbook/
assets/stylesheets/application.css.scss | 1 +
assets/stylesheets/pages/_typescript.scss | 4 ++++
lib/docs/filters/typescript/clean_html.rb | 11 ++++++++++-
lib/docs/filters/typescript/entries.rb | 18 +++++++++++++++++-
lib/docs/scrapers/typescript.rb | 5 ++---
5 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 6d94564c..94881c2e 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -116,6 +116,7 @@
'pages/tcl_tk',
'pages/tensorflow',
'pages/terraform',
+ 'pages/typescript',
'pages/underscore',
'pages/vue',
'pages/webpack',
diff --git a/assets/stylesheets/pages/_typescript.scss b/assets/stylesheets/pages/_typescript.scss
new file mode 100644
index 00000000..ffe7282a
--- /dev/null
+++ b/assets/stylesheets/pages/_typescript.scss
@@ -0,0 +1,4 @@
+._typescript {
+ @extend %simple;
+ .deprecated { @extend %label-red; }
+}
diff --git a/lib/docs/filters/typescript/clean_html.rb b/lib/docs/filters/typescript/clean_html.rb
index 4b9d72fe..8bcc1bd2 100644
--- a/lib/docs/filters/typescript/clean_html.rb
+++ b/lib/docs/filters/typescript/clean_html.rb
@@ -24,7 +24,11 @@ module Docs
def other
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.child.before(deprecated) if deprecated
else # tsconfig page
@doc = at_css('.markdown > div')
@@ -36,9 +40,14 @@ module Docs
css('pre').each do |node|
language = node.at_css('.language-id') ? node.at_css('.language-id').content : 'typescript'
node.css('.language-id').remove
- node.content = node.content
+ if node.at_css('.line').nil?
+ node.content = node.content
+ else
+ node.content = node.css('.line').map(&:content).join("\n")
+ end
node['data-language'] = LANGUAGE_REPLACE[language] || language
node.remove_attribute('class')
+ node.remove_attribute('style')
end
end
diff --git a/lib/docs/filters/typescript/entries.rb b/lib/docs/filters/typescript/entries.rb
index 842afbea..8073f3ea 100644
--- a/lib/docs/filters/typescript/entries.rb
+++ b/lib/docs/filters/typescript/entries.rb
@@ -2,15 +2,31 @@ module Docs
class Typescript
class EntriesFilter < Docs::EntriesFilter
+ DEPRECATED_PAGES = %w(
+ advanced-types
+ basic-types
+ classes
+ functions
+ generics
+ interfaces
+ literal-types
+ unions-and-intersections
+ )
+
def get_name
at_css('h1') ? at_css('h1').content : at_css('h2').content
end
def get_type
- name
+ if DEPRECATED_PAGES.include? slug
+ 'Handbook (deprecated)'
+ else
+ name
+ end
end
def additional_entries
+ return [] if DEPRECATED_PAGES.include? slug
base_url.path == '/' ? tsconfig_entries : handbook_entries
end
diff --git a/lib/docs/scrapers/typescript.rb b/lib/docs/scrapers/typescript.rb
index 6b2c2cb4..dbc6dab6 100644
--- a/lib/docs/scrapers/typescript.rb
+++ b/lib/docs/scrapers/typescript.rb
@@ -3,8 +3,8 @@ module Docs
include MultipleBaseUrls
self.name = 'TypeScript'
- self.type = 'simple'
- self.release = '4.2.2'
+ self.type = 'typescript'
+ self.release = '4.2.3'
self.base_urls = [
'https://www.typescriptlang.org/docs/handbook/',
'https://www.typescriptlang.org/'
@@ -29,7 +29,6 @@ module Docs
]
options[:skip_patterns] = [
- /2/,
/release-notes/,
/play\//
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]