From effe87e351ddac5d96e728f160fbecc0a805905e Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 29 Apr 2021 22:20:01 +0200 Subject: [PATCH] Update HTML documentation --- lib/docs/filters/html/entries.rb | 2 +- lib/docs/filters/mdn/clean_html.rb | 5 +++-- lib/docs/scrapers/mdn/html.rb | 15 ++++----------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/docs/filters/html/entries.rb b/lib/docs/filters/html/entries.rb index 4fbb5303..00324191 100644 --- a/lib/docs/filters/html/entries.rb +++ b/lib/docs/filters/html/entries.rb @@ -17,7 +17,7 @@ module Docs if slug.start_with?('Global_attr') 'Attributes' - elsif at_css('.obsoleteHeader', '.deprecatedHeader', '.nonStandardHeader') || OBSOLETE.include?(slug.remove('Element/')) + elsif at_css('#deprecated', '#non-standard', '#obsolete') || OBSOLETE.include?(slug.remove('Element/')) 'Obsolete' elsif slug.start_with?('Element/') 'Elements' diff --git a/lib/docs/filters/mdn/clean_html.rb b/lib/docs/filters/mdn/clean_html.rb index 71cd02d5..f2f7be90 100644 --- a/lib/docs/filters/mdn/clean_html.rb +++ b/lib/docs/filters/mdn/clean_html.rb @@ -39,10 +39,11 @@ module Docs css('h2 > a[name]', 'h3 > a[name]').each do |node| node.parent['id'] = node['name'] - node.before(node.content).remove + node.before(node.children).remove end css('h2 > a, h3 > a').each do |node| - node.before(node.content).remove + # children instead of content for "Using the download attribute to save a as a PNG" from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a + node.before(node.children).remove end css('.notecard > h4').each do |node| diff --git a/lib/docs/scrapers/mdn/html.rb b/lib/docs/scrapers/mdn/html.rb index 4b28cefd..634570bb 100644 --- a/lib/docs/scrapers/mdn/html.rb +++ b/lib/docs/scrapers/mdn/html.rb @@ -5,20 +5,10 @@ module Docs self.name = 'HTML' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML' - html_filters.push 'html/clean_html', 'html/entries', 'title' + html_filters.push 'html/clean_html', 'html/entries' options[:root_title] = 'HTML' - options[:title] = ->(filter) do - if filter.slug == 'Element/Heading_Elements' - 'Heading Elements' - elsif filter.slug.start_with?('Element/') - "<#{filter.default_title}>" - else - filter.default_title - end - end - options[:skip] = %w( /index /Element/shadow @@ -38,5 +28,8 @@ module Docs url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories') url end + + # self.release = '2021-04-29' + end end