Unified · Split
| @@ -2,7 +2,8 @@ module Docs · 1 unmodified line | |||
| 2 | class Jest | 2 | class Jest |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('article') | 5 | at_css('.markdown').prepend_child(at_css('h1')) |
| 6 | @doc = at_css('.markdown') | ||
| 6 | 7 | ||
| 7 | at_css('h1').content = 'Jest Documentation' if root_page? | 8 | at_css('h1').content = 'Jest Documentation' if root_page? |
| 8 | 9 | ||
| @@ -14,24 +15,15 @@ module Docs · 5 unmodified lines | |||
| 14 | end | 15 | end |
| 15 | 16 | ||
| 16 | css('.prism-code').each do |node| | 17 | css('.prism-code').each do |node| |
| 18 | node.parent.parent.before(node) | ||
| 17 | node.name = 'pre' | 19 | node.name = 'pre' |
| 18 | node['data-language'] = 'js' | 20 | node.remove_attribute('class') |
| 19 | node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class'] | 21 | node['data-language'] = 'typescript' |
| 20 | 22 | node.content = node.css('.token-line').map(&:content).join("\n") | |
| 21 | counter = 0 | ||
| 22 | |||
| 23 | node.css('.token-line').each do |subnode| # add newline each line of the code snippets | ||
| 24 | if counter == 0 | ||
| 25 | else | ||
| 26 | subnode.content = "\n#{subnode.content}" | ||
| 27 | end | ||
| 28 | |||
| 29 | counter += 1 | ||
| 30 | end | ||
| 31 | |||
| 32 | node.content = node.content | ||
| 33 | end | 23 | end |
| 34 | 24 | ||
| 25 | css('*').remove_attribute('style') | ||
| 26 | |||
| 35 | doc | 27 | doc |
| 36 | end | 28 | end |
| 37 | end | 29 | end |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Jest < UrlScraper | 2 | class Jest < UrlScraper |
| 3 | include MultipleBaseUrls | 3 | include MultipleBaseUrls |
| 4 | self.type = 'simple' | 4 | self.type = 'simple' |
| 5 | self.release = '27.0.4' | 5 | self.release = '27.4.3' |
| 6 | 6 | ||
| 7 | self.base_urls = [ | 7 | self.base_urls = [ |
| 8 | 'https://jestjs.io/docs/', | 8 | 'https://jestjs.io/docs/', |
| @@ -18,7 +18,8 @@ module Docs · 9 unmodified lines | |||
| 18 | html_filters.push 'jest/entries', 'jest/clean_html' | 18 | html_filters.push 'jest/entries', 'jest/clean_html' |
| 19 | 19 | ||
| 20 | options[:skip_patterns] = [ | 20 | options[:skip_patterns] = [ |
| 21 | /\d*.x/ # avoid deprecated versions | 21 | /^next/, |
| 22 | /\d+\.[x\d]/ # avoid deprecated versions | ||
| 22 | ] | 23 | ] |
| 23 | 24 | ||
| 24 | options[:attribution] = <<-HTML | 25 | options[:attribution] = <<-HTML |