Prechádzať zdrojové kódy

Fix leaflet documentation

Enoc 4 rokov pred
rodič
commit
432b46fab3

+ 1 - 1
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -483,7 +483,7 @@ credits = [
     'https://ctan.org/pkg/latex2e-help-texinfo/'
   ], [
     'Leaflet',
-    '2010-2019 Vladimir Agafonkin<br>&copy; 2010-2011, CloudMade<br>Maps &copy; OpenStreetMap contributors.',
+    '2010-2021 Vladimir Agafonkin<br>&copy; 2010-2011, CloudMade<br>Maps &copy; OpenStreetMap contributors.',
     'BSD',
     'https://raw.githubusercontent.com/Leaflet/Leaflet/master/LICENSE'
   ], [

+ 5 - 5
lib/docs/scrapers/leaflet.rb

@@ -14,14 +14,14 @@ module Docs
     options[:skip_links] = true
 
     options[:attribution] = <<-HTML
-      &copy; 2010&ndash;2019 Vladimir Agafonkin<br>
+      &copy; 2010&ndash;2021 Vladimir Agafonkin<br>
       &copy; 2010&ndash;2011, CloudMade<br>
       Maps &copy; OpenStreetMap contributors.
     HTML
 
     version '1.7' do
       self.release = '1.7.1'
-      self.base_url = "https://leafletjs.com/reference-#{release}.html"
+      self.base_url = "https://leafletjs.com/reference.html"
     end
 
     version '1.6' do
@@ -60,9 +60,9 @@ module Docs
     end
 
     def get_latest_version(opts)
-      doc = fetch_doc('https://leafletjs.com/index.html', opts)
-      link = doc.css('ul > li > a').to_a.select {|node| node.content == 'Docs'}.first
-      link['href'].scan(/reference-([0-9.]+)\.html/)[0][0]
+      doc = fetch_doc('https://leafletjs.com/reference-versions.html', opts)
+      link = doc.at_css('.container > ul > li:last-child > a').content
+      link.sub(/[a-zA-Z\s]*/, '')
     end
   end
 end