Unified · Split
| @@ -2,6 +2,8 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Lodash |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | + @doc = at_css('h1+div+div') | |
| 6 | + | |
| 5 | 7 | css('h3 + p', 'hr').remove |
| 6 | 8 | |
| 7 | 9 | # Set id attributes on <h3> instead of an empty <a> |
| @@ -4,20 +4,13 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def additional_entries |
| 5 | 5 | entries = [] |
| 6 | 6 | |
| 7 | − css('h2').each do |node| | |
| 8 | − type = node.content.split.first | |
| 9 | − type.remove! %r{\W} # remove quotation marks | |
| 7 | + css('.toc-container h2').each do |heading| | |
| 8 | + type = heading.content.split.first | |
| 10 | 9 | |
| 11 | − node.parent.css('h3').each do |heading| | |
| 12 | − name = heading.content | |
| 13 | − name.sub! %r{\(.+?\)}, '()' | |
| 14 | − entries << [name, heading['id'], type] | |
| 15 | − | |
| 16 | − if h4 = heading.parent.at_css('h4') and h4.content.strip == 'Aliases' | |
| 17 | − h4.next_element.content.split(',').each do |n| | |
| 18 | − entries << ["#{n.strip}()", heading['id'], type] | |
| 19 | − end | |
| 20 | − end | |
| 10 | + heading.parent.css('a').each do |link| | |
| 11 | + name = link.content | |
| 12 | + name = name.remove(/\u{2192}.*/) | |
| 13 | + entries << [name, link['href'].remove('#'), type] | |
| 21 | 14 | end |
| 22 | 15 | end |
| 23 | 16 | |
| @@ -1,15 +1,14 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Lodash < UrlScraper |
| 3 | − self.name = 'Lo-Dash' | |
| 3 | + self.name = 'lodash' | |
| 4 | 4 | self.slug = 'lodash' |
| 5 | 5 | self.type = 'lodash' |
| 6 | − self.version = '3.1.0' | |
| 6 | + self.version = '3.2.0' | |
| 7 | 7 | self.base_url = 'https://lodash.com/docs' |
| 8 | 8 | |
| 9 | − html_filters.push 'lodash/clean_html', 'lodash/entries', 'title' | |
| 9 | + html_filters.push 'lodash/entries', 'lodash/clean_html', 'title' | |
| 10 | 10 | |
| 11 | − options[:title] = 'Lo-Dash' | |
| 12 | − options[:container] = 'h1+div+div' | |
| 11 | + options[:title] = 'lodash' | |
| 13 | 12 | options[:skip_links] = true |
| 14 | 13 | |
| 15 | 14 | options[:attribution] = <<-HTML |