Browse Source

Update JavaScript documentation

Thibaut 11 năm trước cách đây
mục cha
commit
10b4f445f7

+ 1 - 2
lib/docs/filters/javascript/clean_html.rb

@@ -7,9 +7,8 @@ module Docs
       end
 
       def root
-        css(*%w(#About_this_Reference+div #About_this_Reference #Comments~* #Comments)).remove
-
         # Move "Global Objects" lists to the same level as the other ones
+        css('#Global_Objects + p').remove
         div = at_css '#Global_Objects + div'
         div.css('h3').each { |node| node.name = 'h2' }
         at_css('#Global_Objects').replace(div.children)

+ 4 - 2
lib/docs/filters/javascript/entries.rb

@@ -1,7 +1,8 @@
 module Docs
   class Javascript
     class EntriesFilter < Docs::EntriesFilter
-      TYPES = %w(Array Boolean Date Function Intl JSON Math Number Object RegExp String)
+      TYPES = %w(Array Boolean Date Function Intl JSON Map Math Number Object
+        RegExp Set String Symbol WeakMap WeakSet)
       INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)
 
       def get_name
@@ -19,6 +20,7 @@ module Docs
           name
         else
           name = super
+          name.remove! 'Functions.'
           name.remove! 'Functions and function scope.'
           name.remove! 'Operators.'
           name.remove! 'Statements.'
@@ -31,7 +33,7 @@ module Docs
           'Statements'
         elsif slug.start_with? 'Operators'
           'Operators'
-        elsif slug.start_with? 'Functions_and_function_scope'
+        elsif slug.start_with?('Functions_and_function_scope') || slug.start_with?('Functions')
           'Function'
         elsif slug.start_with? 'Global_Objects'
           object, method = *slug.remove('Global_Objects/').split('/')

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

@@ -17,8 +17,14 @@ module Docs
       /Global_Objects/Iterator
       /Global_Objects/Proxy
       /Reserved_Words
+      /Functions/arguments
       /arrow_functions
-      /rest_parameters)
+      /rest_parameters
+      /default_parameters
+      /Strict_mode
+      /Functions/rest_parameters
+      /Methods_Index
+      /Properties_Index)
 
     # Duplicates
     options[:skip].concat %w(