1
0
Эх сурвалжийг харах

Update HTML documentation

Simon Legner 4 жил өмнө
parent
commit
effe87e351

+ 1 - 1
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'

+ 3 - 2
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 <canvas> 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|

+ 4 - 11
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