Skip to content

Commit 41d6481

Browse files
committed
Update lodash documentation (4.16.2, 3.10.1, 2.4.2)
1 parent 2acc137 commit 41d6481

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

assets/stylesheets/components/_content.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@
163163
}
164164
}
165165

166+
._heading-links {
167+
float: right;
168+
font-weight: normal;
169+
170+
> a + a { margin-left: .25rem; }
171+
}
172+
166173
//
167174
// Table of contents
168175
//

assets/stylesheets/global/_classes.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
margin: 2em 0 1em;
9191
padding-left: .5em;
9292
padding-right: .5em;
93+
overflow: hidden;
9394
font-size: inherit;
9495
color: $boxHeaderColor;
9596
border: 1px solid $boxBorder;

lib/docs/filters/lodash/clean_html.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,26 @@ module Docs
22
class Lodash
33
class CleanHtmlFilter < Filter
44
def call
5-
@doc = at_css('h1+div+div')
5+
@doc = at_css('.doc-container')
66

7-
css('h3 + p', 'hr').remove
8-
9-
css('h2 a:contains("#")', 'h3 a:contains("#")').remove
7+
css('> div', '> div > div', '.highlight').each do |node|
8+
node.before(node.children).remove
9+
end
1010

1111
# Remove <code> inside headings
1212
css('h2', 'h3').each do |node|
1313
node.content = node.content
1414
end
1515

16+
css('h3 + p > a:first-child').each do |node|
17+
node.parent.previous_element << %(<div class="_heading-links">#{node.parent.inner_html}</div>)
18+
node.parent.remove
19+
end
20+
1621
# Remove code highlighting
1722
css('pre').each do |node|
18-
node.inner_html = node.inner_html.gsub('<br>', "\n").gsub('&nbsp;', ' ')
19-
node.content = node.content
23+
node.inner_html = node.inner_html.gsub('</div>', "</div>\n").gsub('&nbsp;', ' ')
24+
node.content = node.content.strip
2025
node['data-language'] = 'javascript'
2126
end
2227

lib/docs/filters/lodash/entries.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def additional_entries
99

1010
heading.parent.css('a').each do |link|
1111
name = link.content
12-
name = name.remove(/\u{279C}.*/)
12+
name.remove! %r{\s.*}
1313
entries << [name, link['href'].remove('#'), type]
1414
end
1515
end

lib/docs/scrapers/lodash.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ class Lodash < UrlScraper
1919
HTML
2020

2121
version '4' do
22-
self.release = '4.15.0'
23-
self.base_url = 'https://lodash.com/docs'
22+
self.release = '4.16.2'
23+
self.base_url = "https://lodash.com/docs/#{release}"
2424
end
2525

2626
version '3' do
27-
self.release = '3.10.0'
28-
self.base_url = 'https://lodash.com/docs' # OUT-OF-DATE
27+
self.release = '3.10.1'
28+
self.base_url = "https://lodash.com/docs/#{release}"
29+
end
30+
31+
version '2' do
32+
self.release = '2.4.2'
33+
self.base_url = "https://lodash.com/docs/#{release}"
2934
end
3035
end
3136
end

0 commit comments

Comments
 (0)