Skip to content

Commit 15f79fa

Browse files
committed
Finish Leaflet scraper
1 parent 4bd451a commit 15f79fa

File tree

11 files changed

+45
-13
lines changed

11 files changed

+45
-13
lines changed

assets/images/docs-2.png

479 Bytes
Loading

assets/images/[email protected]

1.22 KB
Loading

assets/javascripts/news.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[
22
[
3+
"2018-07-08",
4+
"New documentation: <a href=\"/leaflet/\">Leaflet</a>"
5+
], [
36
"2018-03-26",
47
"DevDocs is joining the freeCodeCamp community. Read the announcement <a href=\"https://medium.freecodecamp.org/devdocs-is-joining-the-freecodecamp-community-ae185a1c14a6\" target=\"_blank\">here</a>."
58
], [

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ credits = [
375375
'Taylor Otwell',
376376
'MIT',
377377
'https://raw.githubusercontent.com/laravel/framework/master/LICENSE.txt'
378+
], [
379+
'Leaflet',
380+
'2010-2018 Vladimir Agafonkin<br>&copy; 2010-2011, CloudMade<br>Maps &copy; OpenStreetMap contributors.',
381+
'BSD',
382+
'https://raw.githubusercontent.com/Leaflet/Leaflet/master/LICENSE'
378383
], [
379384
'Less',
380385
'2009-2016 The Core Less Team',

assets/stylesheets/global/_icons.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,4 @@
170170
._icon-homebrew:before { background-position: 0 -3rem; @extend %doc-icon-2; }
171171
._icon-jekyll:before { background-position: -1rem -3rem; @extend %doc-icon-2; }
172172
._icon-babel:before { background-position: -2rem -3rem; @extend %doc-icon-2; }
173+
._icon-leaflet:before { background-position: -3rem -3rem; @extend %doc-icon-2; }

lib/docs/filters/leaflet/clean_html.rb

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,35 @@ module Docs
22
class Leaflet
33
class CleanHtmlFilter < Filter
44
def call
5-
css('#toc', '.expander').remove
5+
css('#toc', '.expander', '.footer').remove
6+
7+
css('h1').each do |node|
8+
node.name = 'h2'
9+
end
10+
11+
at_css('> h2:first-child').name = 'h1'
612

713
# remove "This reference reflects Leaflet 1.2.0."
8-
css('h2 ~ p').each do |node|
14+
css('h1 ~ p').each do |node|
915
node.remove
1016
break
1117
end
1218

13-
# syntax highlighting
14-
css('code.lang-js').each do |node|
15-
node.parent['data-language'] = 'javascript'
16-
node.parent.content = node.content
19+
css('section', 'code b', '.accordion', '.accordion-overflow', '.accordion-content').each do |node|
20+
node.before(node.children).remove
21+
end
22+
23+
css('pre > code').each do |node|
24+
node['class'] ||= ''
25+
lang = if node['class'].include?('lang-html') || node.content =~ /\A</
26+
'html'
27+
elsif node['class'].include?('lang-css')
28+
'css'
29+
elsif node['class'].include?('lang-js') || node['class'].include?('lang-javascript')
30+
'javascript'
31+
end
32+
node.parent['data-language'] = lang if lang
33+
node.before(node.children).remove
1734
end
1835

1936
doc

lib/docs/scrapers/leaflet.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module Docs
22
class Leaflet < UrlScraper
33
self.name = 'Leaflet'
4-
self.type = 'leaflet'
4+
self.type = 'simple'
55
self.slug = 'leaflet'
66
self.links = {
7-
home: 'http://leafletjs.com/',
7+
home: 'https://leafletjs.com/',
88
code: 'https://github.com/Leaflet/Leaflet'
99
}
1010

@@ -14,23 +14,29 @@ class Leaflet < UrlScraper
1414
options[:skip_links] = true
1515

1616
options[:attribution] = <<-HTML
17-
&copy; 2017 <a href="http://agafonkin.com/en">Vladimir Agafonkin</a>.
18-
Maps &copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors.</p>
17+
&copy; 2010&ndash;2018 Vladimir Agafonkin<br>
18+
&copy; 2010&ndash;2011, CloudMade<br>
19+
Maps &copy; OpenStreetMap contributors.
1920
HTML
2021

22+
version '1.3' do
23+
self.release = '1.3.0'
24+
self.base_url = "https://leafletjs.com/reference-#{release}.html"
25+
end
26+
2127
version '1.2' do
2228
self.release = '1.2.0'
23-
self.base_url = "http://leafletjs.com/reference-#{release}.html"
29+
self.base_url = "https://leafletjs.com/reference-#{release}.html"
2430
end
2531

2632
version '1.1' do
2733
self.release = '1.1.0'
28-
self.base_url = "http://leafletjs.com/reference-#{release}.html"
34+
self.base_url = "https://leafletjs.com/reference-#{release}.html"
2935
end
3036

3137
version '1.0' do
3238
self.release = '1.0.3'
33-
self.base_url = "http://leafletjs.com/reference-#{release}.html"
39+
self.base_url = "https://leafletjs.com/reference-#{release}.html"
3440
end
3541

3642
end

public/icons/docs-2.pxm

34.8 KB
Binary file not shown.

public/icons/[email protected]

34.5 KB
Binary file not shown.

public/icons/docs/leaflet/16.png

-156 Bytes
Loading

0 commit comments

Comments
 (0)