[devdocsgjs/main: 956/1867] Add Sequelize documentation




commit 2bdf3a05d001a2fbd82d17a0821269a0de7fdfd7
Author: Waldir Pimenta <waldyrious gmail com>
Date:   Sat Oct 12 14:55:25 2019 +0100

    Add Sequelize documentation

 .../javascripts/templates/pages/about_tmpl.coffee  |   5 ++++
 lib/docs/filters/sequelize/clean_html.rb           |  33 +++++++++++++++++++++
 lib/docs/filters/sequelize/entries.rb              |  26 ++++++++++++++++
 lib/docs/scrapers/sequelize.rb                     |  30 +++++++++++++++++++
 public/icons/docs/sequelize/16.png                 | Bin 0 -> 1360 bytes
 public/icons/docs/sequelize/16 2x png              | Bin 0 -> 37753 bytes
 public/icons/docs/sequelize/SOURCE                 |   1 +
 7 files changed, 95 insertions(+)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 985155ae..5bdcf63b 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -701,6 +701,11 @@ credits = [
     '2010-2018 Christian Johansen',
     'BSD',
     'https://raw.githubusercontent.com/sinonjs/sinon/master/LICENSE'
+  ], [
+    'Sequelize',
+    '2014—present Sequelize contributors',
+    'MIT',
+    'https://raw.githubusercontent.com/sequelize/sequelize/master/LICENSE'
   ], [
     'Socket.io',
     '2014-2015 Automattic',
diff --git a/lib/docs/filters/sequelize/clean_html.rb b/lib/docs/filters/sequelize/clean_html.rb
new file mode 100644
index 00000000..ee9246ab
--- /dev/null
+++ b/lib/docs/filters/sequelize/clean_html.rb
@@ -0,0 +1,33 @@
+module Docs
+  class Sequelize
+    class CleanHtmlFilter < Filter
+      def call
+        # Clean up the home page
+        if root_page?
+          # Remove logo
+          css('.manual-user-index > div > div.logo').remove
+          # Convert title to proper H1 element
+          at_css('.manual-user-index > div > div.sequelize').name = 'h1'
+          # Remove badges (NPM, Travis, test coverage, etc.)
+          css('.manual-user-index > p:nth-child(4)').remove
+          # Remove image cards pointing to entries of the manual
+          css('.manual-cards').remove
+        end
+
+        # Add syntax highlighting to code blocks
+        css('pre > code[class^="lang-"]').each do |node|
+          pre = node.parent
+          # Convert the existing language definitions to Prism-compatible attributes
+          pre['data-language'] = 'javascript' if node['class'] == 'lang-js' || node['class'] == 
'lang-javascript'
+          pre['data-language'] = 'json'       if node['class'] == 'lang-json'
+          pre['data-language'] = 'shell'      if node['class'] == 'lang-sh' || node['class'] == 'lang-bash'
+          pre['data-language'] = 'sql'        if node['class'] == 'lang-sql'
+          pre['data-language'] = 'typescript' if node['class'] == 'lang-ts'
+        end
+
+        # Return the cleaned-up document
+        doc
+      end
+    end
+  end
+end
diff --git a/lib/docs/filters/sequelize/entries.rb b/lib/docs/filters/sequelize/entries.rb
new file mode 100644
index 00000000..a3866386
--- /dev/null
+++ b/lib/docs/filters/sequelize/entries.rb
@@ -0,0 +1,26 @@
+module Docs
+  class Sequelize
+    class EntriesFilter < Docs::EntriesFilter
+      # Use the main title as the page name
+      def get_name
+        at_css('h1').text
+      end
+
+      # Assign the pages to main categories
+      def get_type
+        if path.start_with?('manual/')
+          type = 'Manual'
+        elsif path.start_with?('file/lib/')
+          type = 'Source files'
+        else
+          # API Reference pages. The `path` for most of these starts with 'class/lib/',
+          # but there's also 'variable/index' (pseudo-classes), and 'identifiers' (the main index)
+          # so we use an unqualified `else` as a catch-all.
+          type = 'Reference'
+        end
+
+        type
+      end
+    end
+  end
+end
diff --git a/lib/docs/scrapers/sequelize.rb b/lib/docs/scrapers/sequelize.rb
new file mode 100644
index 00000000..e5bc4e80
--- /dev/null
+++ b/lib/docs/scrapers/sequelize.rb
@@ -0,0 +1,30 @@
+module Docs
+  class Sequelize < UrlScraper
+    self.name = 'Sequelize'
+    self.slug = 'sequelize'
+    self.type = 'simple'
+    self.release = '5.19.6'
+    self.base_url = 'https://sequelize.org/master/'
+    self.links = {
+      home: 'https://sequelize.org/',
+      code: 'https://github.com/sequelize/sequelize/'
+    }
+
+    # List of content filters (to be applied sequentially)
+    html_filters.push 'sequelize/entries', 'sequelize/clean_html'
+
+    # Wrapper element that holds the main content
+    options[:container] = '.content'
+
+    # License information that appears appears at the bottom of the entry page
+    options[:attribution] = <<-HTML
+      Copyright &copy; 2014&ndash;present Sequelize contributors<br>
+      Licensed under the MIT License.
+    HTML
+
+    # Method to fetch the most recent version of the project
+    def get_latest_version(opts)
+     get_npm_version('sequelize', opts)
+    end
+  end
+end
diff --git a/public/icons/docs/sequelize/16.png b/public/icons/docs/sequelize/16.png
new file mode 100644
index 00000000..c80f6561
Binary files /dev/null and b/public/icons/docs/sequelize/16.png differ
diff --git a/public/icons/docs/sequelize/16 2x png b/public/icons/docs/sequelize/16 2x png
new file mode 100644
index 00000000..78cb63a6
Binary files /dev/null and b/public/icons/docs/sequelize/16 2x png differ
diff --git a/public/icons/docs/sequelize/SOURCE b/public/icons/docs/sequelize/SOURCE
new file mode 100644
index 00000000..03a2f866
--- /dev/null
+++ b/public/icons/docs/sequelize/SOURCE
@@ -0,0 +1 @@
+https://github.com/sequelize/sequelize/blob/master/docs/images/logo.png


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