Update Modernizr documentation (3.1.0)

pull/281/head
Thibaut 10 years ago
parent bdcc5227db
commit 6690c9d6a0

@ -6,12 +6,12 @@ module Docs
node.content = node.content node.content = node.content
end end
css('> div', '> section').each do |node| css('sub').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end
css('h3, h4').each do |node| css('td:nth-child(2)').each do |node|
node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } node.name = node.previous_element.name = 'th'
end end
doc doc

@ -5,27 +5,14 @@ module Docs
entries = [] entries = []
css('h3[id]').each do |node| css('h3[id]').each do |node|
next unless name = node.content.strip[/\AModernizr\.\w+\(\)/] next unless name = node.content.strip[/\AModernizr\..+/]
entries << [name, node['id'], 'Modernizr'] entries << [name, node['id'], 'Modernizr']
end end
css('section[id]').each do |node| css('h2[id="features"] + table td:nth-child(2) b').each do |node|
next unless heading = node.at_css('h3') node['id'] = node.content.parameterize
next unless name = heading.content.strip[/\A(Modernizr\.)?\w+\(\)/] node.content.split(',').each do |name|
entries << [name, node['id'], 'Features']
heading['id'] = node['id']
node.remove_attribute('id')
name.prepend('Modernizr.') unless name.start_with?('Modernizr')
entries << [name, heading['id'], 'Modernizr']
end
css('h4[id^="features-"] + table').each do |table|
type = table.previous_element.content.strip
type << ' features' unless type.end_with?('features')
table.css('tbody th[id]').each do |node|
entries << [node.content, node['id'], type]
end end
end end

@ -2,17 +2,17 @@ module Docs
class Modernizr < UrlScraper class Modernizr < UrlScraper
self.name = 'Modernizr' self.name = 'Modernizr'
self.type = 'modernizr' self.type = 'modernizr'
self.version = '2.8.3' self.version = '3.1.0'
self.base_url = 'http://modernizr.com/docs/' self.base_url = 'https://modernizr.com/docs/'
html_filters.push 'modernizr/entries', 'modernizr/clean_html', 'title' html_filters.push 'modernizr/entries', 'modernizr/clean_html', 'title'
options[:title] = 'Modernizr' options[:title] = 'Modernizr'
options[:container] = '#documentation' options[:container] = '#main'
options[:skip_links] = true options[:skip_links] = true
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2009&ndash;2014 Modernizr<br> &copy; 2009&ndash;2015 Modernizr<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
end end

Loading…
Cancel
Save