From 7fd7b0e1513590210fcb945c850ad899b83f74f4 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Tue, 21 Feb 2023 18:58:22 +0100 Subject: [PATCH] Update Babel documentation (7.21.1) See #1926 --- lib/docs/filters/babel/clean_html.rb | 15 ++++++++++----- lib/docs/scrapers/babel.rb | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/docs/filters/babel/clean_html.rb b/lib/docs/filters/babel/clean_html.rb index 33cfa56a..d573b65c 100644 --- a/lib/docs/filters/babel/clean_html.rb +++ b/lib/docs/filters/babel/clean_html.rb @@ -3,6 +3,8 @@ module Docs class CleanHtmlFilter < Filter def call + @doc = at_css('.theme-doc-markdown') + css('.fixedHeaderContainer').remove css('.toc').remove @@ -15,14 +17,17 @@ module Docs css('.docs-prevnext').remove - css('pre > code.hljs').each do |node| - node.parent['data-language'] = node['class'][/language-(\w+)/, 1] - end - css('pre').each do |node| - node.content = node.content + node.content = node.css('.token-line').map(&:content).join("\n") + node['data-language'] = node['class'][/language-(\w+)/, 1] end + css('.codeBlockTitle_x_ju').remove + + css('*').remove_attr('class') + + css('*').remove_attr('style') + doc end diff --git a/lib/docs/scrapers/babel.rb b/lib/docs/scrapers/babel.rb index 2482f9bc..d095495c 100644 --- a/lib/docs/scrapers/babel.rb +++ b/lib/docs/scrapers/babel.rb @@ -1,7 +1,7 @@ module Docs class Babel < UrlScraper self.type = 'simple' - self.base_url = 'https://babeljs.io/docs/en/' + self.base_url = 'https://babeljs.io/docs/' self.links = { home: 'https://babeljs.io/', code: 'https://github.com/babel/babel' @@ -30,7 +30,7 @@ module Docs HTML version '7' do - self.release = '7.16.4' + self.release = '7.21.1' end version '6' do