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

Update HTML documentation ()

Simon Legner 6 сар өмнө
parent
commit
6797b57aed

+ 10 - 9
lib/docs/filters/html/entries.rb

@@ -5,21 +5,22 @@ module Docs
 
       def get_name
         name = super
-        name.sub!('Element.', '').try(:downcase!)
-        name.sub!('Global attributes.', '').try(:concat, ' (attribute)')
+        name.sub!('Guides.', '')
+        name.sub!('How to.', '')
+        name.sub!('Reference.Elements.', '').try(:downcase!)
+        name.sub!('Reference.Attributes.', '').try(:concat, ' (attribute)')
+        name.sub!('Reference.Global attributes.', '').try(:concat, ' (attribute)')
         name.sub!(/input\.([-\w]+)/, 'input type="\1"')
         name
       end
 
       def get_type
-        return 'Miscellaneous' if slug.include?('CORS') || slug.include?('Using')
-
         if at_css('.deprecated', '.non-standard', '.obsolete')
-        'Obsolete'
-        elsif slug.start_with?('Global_attr')
-          'Attributes'
-        elsif slug.start_with?('Element/')
-          'Elements'
+          'Obsolete'
+        elsif slug.start_with?('Guides/')
+          'Guides'
+        elsif slug.start_with?('Reference/')
+          slug.split('/').drop(1).first.sub(/_/, ' ')
         else
           'Miscellaneous'
         end

+ 1 - 7
lib/docs/scrapers/mdn/html.rb

@@ -2,7 +2,7 @@ module Docs
   class Html < Mdn
     prepend FixInternalUrlsBehavior
 
-    # release = '2024-08-20'
+    # release = '2025-06-01'
     self.name = 'HTML'
     self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
     self.links = {
@@ -22,11 +22,5 @@ module Docs
       '/Element/h5' => '/Element/Heading_Elements',
       '/Element/h6' => '/Element/Heading_Elements',
       '/Global_attributes/data-%2A' => '/Global_attributes/data-*' }
-
-    options[:fix_urls] = ->(url) do
-      url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')
-      url
-    end
-
   end
 end

+ 1 - 1
lib/docs/scrapers/mdn/mdn.rb

@@ -18,7 +18,7 @@ module Docs
     }
 
     options[:attribution] = <<-HTML
-      &copy; 2005&ndash;2024 MDN contributors.<br>
+      &copy; 2005&ndash;2025 MDN contributors.<br>
       Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
     HTML