[devdocsgjs/main: 1506/1867] Update D3.js documentation (6.5.0)




commit 86d23b71271fe830531ee58ba36d660610649b87
Author: Simon Legner <Simon Legner gmail com>
Date:   Thu Feb 18 18:24:57 2021 +0100

    Update D3.js documentation (6.5.0)

 assets/javascripts/templates/pages/about_tmpl.coffee |  2 +-
 lib/docs/filters/d3/clean_html.rb                    |  3 +++
 lib/docs/filters/d3/entries_v4.rb                    |  5 +++++
 lib/docs/scrapers/d3.rb                              | 18 +++++++++++++++++-
 4 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index ea4b43ae..d788b500 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -223,7 +223,7 @@ credits = [
     'https://raw.githubusercontent.com/dlang/phobos/master/LICENSE_1_0.txt'
   ], [
     'D3.js',
-    '2010-2018 Michael Bostock',
+    '2010-2020 Michael Bostock',
     'BSD',
     'https://raw.githubusercontent.com/d3/d3/master/LICENSE'
   ], [
diff --git a/lib/docs/filters/d3/clean_html.rb b/lib/docs/filters/d3/clean_html.rb
index 468324d7..ab0641de 100644
--- a/lib/docs/filters/d3/clean_html.rb
+++ b/lib/docs/filters/d3/clean_html.rb
@@ -31,6 +31,9 @@ module Docs
           node.content = 'Source'
           node['class'] = 'source'
         end
+        css('h6 a:contains("Source"), h6 a:contains("Examples")').each do |node|
+          node['class'] = 'source'
+        end
 
         # Fix internal links
         css('a[href]').each do |node|
diff --git a/lib/docs/filters/d3/entries_v4.rb b/lib/docs/filters/d3/entries_v4.rb
index 9ea845e6..a87d4037 100644
--- a/lib/docs/filters/d3/entries_v4.rb
+++ b/lib/docs/filters/d3/entries_v4.rb
@@ -18,8 +18,13 @@ module Docs
       def additional_entries
         css('h6[id]').each_with_object [] do |node, entries|
           name = node.content.strip
+          name.remove! 'Source, Examples'
           name.remove! 'Source'
+          name.remove! 'Examples'
           name.remove! '<>'
+          name.remove! ' ยท '
+          name.remove! '0,' # from d3.quickselect
+          name.remove! '=' # from d3.quickselect
           name.remove! %r{\s\-.*}
           name.remove! %r{\s*\[.*\]}
           name.gsub! %r{\(.+?\)\)?}, '()'
diff --git a/lib/docs/scrapers/d3.rb b/lib/docs/scrapers/d3.rb
index e26c1f3d..bcbdfe49 100644
--- a/lib/docs/scrapers/d3.rb
+++ b/lib/docs/scrapers/d3.rb
@@ -12,10 +12,26 @@ module Docs
     options[:container] = '.markdown-body'
 
     options[:attribution] = <<-HTML
-      &copy; 2010&ndash;2018 Michael Bostock<br>
+      &copy; 2010&ndash;2020 Michael Bostock<br>
       Licensed under the BSD License.
     HTML
 
+    version '6' do
+      self.release = '6.5.0'
+      self.base_url = 'https://github.com/d3/'
+      self.root_path = 'd3/blob/master/API.md'
+
+      html_filters.push 'd3/clean_html', 'd3/entries_v4'
+
+      options[:only_patterns] = [/\Ad3[\-\w]+\z/, /\Ad3\/blob\/master\/changes\.md\z/i]
+      options[:skip_patterns] = [/3\.x-api-reference/]
+
+      options[:fix_urls] = ->(url) do
+        url.sub! %r{/blob/master/readme.md}i, ''
+        url
+      end
+    end
+
     version '5' do
       self.release = '5.7.0'
       self.base_url = 'https://github.com/d3/'


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]