diff --git a/lib/docs/filters/javascript/clean_html.rb b/lib/docs/filters/javascript/clean_html.rb
index 15b87225..4ad954de 100644
--- a/lib/docs/filters/javascript/clean_html.rb
+++ b/lib/docs/filters/javascript/clean_html.rb
@@ -7,15 +7,12 @@ module Docs
end
def root
- css(*%w(#About_this_Reference+div #About_this_Reference
- #Typed_array_constructors+ul #Typed_array_constructors
- #Internationalization_constructors+ul #Internationalization_constructors
- #Comments~* #Comments)).remove
+ css(*%w(#About_this_Reference+div #About_this_Reference #Comments~* #Comments)).remove
# Move "Global Objects" lists to the same level as the other ones
div = at_css '#Global_Objects + div'
div.css('h3').each { |node| node.name = 'h2' }
- at_css('#Global_Objects').replace(div)
+ at_css('#Global_Objects').replace(div.children)
# Remove heading links
css('h2 > a').each do |node|
@@ -25,9 +22,15 @@ module Docs
end
def other
+ # Remove "style" attribute
css('.inheritsbox', '.overheadIndicator').each do |node|
node.remove_attribute 'style'
end
+
+ # Remove
wrapping .overheadIndicator
+ css('div > .overheadIndicator:first-child:last-child').each do |node|
+ node.parent.replace(node)
+ end
end
end
end
diff --git a/lib/docs/filters/javascript/entries.rb b/lib/docs/filters/javascript/entries.rb
index 0abf6952..28020af1 100644
--- a/lib/docs/filters/javascript/entries.rb
+++ b/lib/docs/filters/javascript/entries.rb
@@ -1,28 +1,17 @@
module Docs
class Javascript
class EntriesFilter < Docs::EntriesFilter
- TYPES = %w(Array Boolean Date Function JSON Math Number Object RegExp String)
-
- ADDITIONAL_ENTRIES = {
- 'operators/arithmetic_operators' => [
- %w(++ .2B.2B_.28Increment.29),
- %w(-- --_.28Decrement.29) ],
- 'operators/bitwise_operators' => [
- %w(& .26_(Bitwise_AND)),
- %w(| .7C_(Bitwise_OR)),
- %w(^ .5E_(Bitwise_XOR)),
- %w(~ .7E_(Bitwise_NOT)),
- %w(<< <<_(Left_shift)),
- %w(>> >>_(Sign-propagating_right_shift)),
- %w(>>> >>>_(Zero-fill_right_shift)) ]}
+ TYPES = %w(Array Boolean Date Function Intl JSON Math Number Object RegExp String)
+ INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)
def get_name
if slug.start_with? 'Global_Objects/'
name, method = *slug.sub('Global_Objects/', '').split('/')
+ name.prepend 'Intl.' if INTL_OBJECTS.include?(name)
if method
unless method == method.upcase || method == 'NaN'
- method = method[0].downcase + method[1..-1] # e.g. Constructor => constructor
+ method = method[0].downcase + method[1..-1] # e.g. Trim => trim
end
name << ".#{method}"
end
@@ -48,16 +37,26 @@ module Docs
object, method = *slug.sub('Global_Objects/', '').split('/')
if object.end_with? 'Error'
'Errors'
+ elsif INTL_OBJECTS.include?(object)
+ 'Intl'
elsif method || TYPES.include?(object)
object
else
'Global Objects'
end
+ else
+ 'Miscellaneous'
end
end
- def additional_entries
- ADDITIONAL_ENTRIES[slug] || []
+ def include_default_entry?
+ node = doc.at_css '.overheadIndicator'
+
+ # Can't use :first-child because #doc is a DocumentFragment
+ return true unless node && node.parent == doc && !node.previous_element
+
+ !node.content.include?('not on a standards track') &&
+ !node.content.include?('removed from the Web')
end
end
end
diff --git a/lib/docs/scrapers/mdn/javascript.rb b/lib/docs/scrapers/mdn/javascript.rb
index 1f91dd7f..1ccc7286 100644
--- a/lib/docs/scrapers/mdn/javascript.rb
+++ b/lib/docs/scrapers/mdn/javascript.rb
@@ -14,18 +14,12 @@ module Docs
/Deprecated_Features
/Deprecated_and_obsolete_features
/Functions_and_function_scope
- /Functions_and_function_scope/Strict_mode
/Global_Objects/Iterator
- /Global_Objects/Number/toInteger
- /Global_Objects/ParallelArray
/Global_Objects/Proxy
- /Global_Objects/uneval
/Reserved_Words
/arrow_functions
/rest_parameters)
- options[:skip_patterns] = [/Intl/, /Collator/, /DateTimeFormat/, /NumberFormat/]
-
# Duplicates
options[:skip].concat %w(
/Global_Objects