[devdocsgjs/main: 49/239] Update Jest documentation (27.4.3)
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 49/239] Update Jest documentation (27.4.3)
- Date: Fri, 8 Apr 2022 07:47:34 +0000 (UTC)
commit 73814d55cc42142604feeeaef49d93eaacaeb64d
Author: Simon Legner <Simon Legner gmail com>
Date: Sun Dec 5 01:56:24 2021 +0100
Update Jest documentation (27.4.3)
lib/docs/filters/jest/clean_html.rb | 24 ++++++++----------------
lib/docs/scrapers/jest.rb | 5 +++--
2 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/lib/docs/filters/jest/clean_html.rb b/lib/docs/filters/jest/clean_html.rb
index 082fdb30..2cf74b9a 100644
--- a/lib/docs/filters/jest/clean_html.rb
+++ b/lib/docs/filters/jest/clean_html.rb
@@ -2,7 +2,8 @@ module Docs
class Jest
class CleanHtmlFilter < Filter
def call
- @doc = at_css('article')
+ at_css('.markdown').prepend_child(at_css('h1'))
+ @doc = at_css('.markdown')
at_css('h1').content = 'Jest Documentation' if root_page?
@@ -14,24 +15,15 @@ module Docs
end
css('.prism-code').each do |node|
+ node.parent.parent.before(node)
node.name = 'pre'
- node['data-language'] = 'js'
- node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
-
- counter = 0
-
- node.css('.token-line').each do |subnode| # add newline each line of the code snippets
- if counter == 0
- else
- subnode.content = "\n#{subnode.content}"
- end
-
- counter += 1
- end
-
- node.content = node.content
+ node.remove_attribute('class')
+ node['data-language'] = 'typescript'
+ node.content = node.css('.token-line').map(&:content).join("\n")
end
+ css('*').remove_attribute('style')
+
doc
end
end
diff --git a/lib/docs/scrapers/jest.rb b/lib/docs/scrapers/jest.rb
index 879cec8b..b2ab00b2 100644
--- a/lib/docs/scrapers/jest.rb
+++ b/lib/docs/scrapers/jest.rb
@@ -2,7 +2,7 @@ module Docs
class Jest < UrlScraper
include MultipleBaseUrls
self.type = 'simple'
- self.release = '27.0.4'
+ self.release = '27.4.3'
self.base_urls = [
'https://jestjs.io/docs/',
@@ -18,7 +18,8 @@ module Docs
html_filters.push 'jest/entries', 'jest/clean_html'
options[:skip_patterns] = [
- /\d*.x/ # avoid deprecated versions
+ /^next/,
+ /\d+\.[x\d]/ # avoid deprecated versions
]
options[:attribution] = <<-HTML
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]