[devdocsgjs/main: 1343/1867] Add Pallets projects (Flask, Jinja, and Werkzeug) documentation




commit 319074f6b78e0edc57b22455285c344d01c9b6eb
Author: Phil Scherer <pnscher evoforge org>
Date:   Mon Dec 7 02:07:23 2020 +0000

    Add Pallets projects (Flask, Jinja, and Werkzeug) documentation

 .../javascripts/templates/pages/about_tmpl.coffee  |  15 ++++
 lib/docs/filters/flask/entries.rb                  |  82 +++++++++++++++++++++
 lib/docs/filters/jinja/entries.rb                  |  55 ++++++++++++++
 lib/docs/filters/werkzeug/entries.rb               |  61 +++++++++++++++
 lib/docs/scrapers/flask.rb                         |  40 ++++++++++
 lib/docs/scrapers/jinja.rb                         |  39 ++++++++++
 lib/docs/scrapers/werkzeug.rb                      |  39 ++++++++++
 public/icons/docs/flask/16.png                     | Bin 0 -> 2293 bytes
 public/icons/docs/flask/16 2x png                  | Bin 0 -> 2709 bytes
 public/icons/docs/flask/SOURCE                     |   1 +
 public/icons/docs/jinja/16.png                     | Bin 0 -> 11796 bytes
 public/icons/docs/jinja/16 2x png                  | Bin 0 -> 12597 bytes
 public/icons/docs/jinja/SOURCE                     |   1 +
 public/icons/docs/werkzeug/16.png                  | Bin 0 -> 801 bytes
 public/icons/docs/werkzeug/16 2x png               | Bin 0 -> 4348 bytes
 public/icons/docs/werkzeug/SOURCE                  |   1 +
 16 files changed, 334 insertions(+)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index afaf37a3..2b0f00b2 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -306,6 +306,11 @@ credits = [
     '2005-2009 Axel Liljencrantz',
     'GPLv2',
     'https://fishshell.com/docs/current/license.html'
+  ], [
+    'Flask',
+    '2007-2020 Pallets',
+    'BSD',
+    'https://github.com/pallets/flask/blob/master/LICENSE.rst'
   ], [
     'GCC<br>GNU Fortran',
     'Free Software Foundation',
@@ -396,6 +401,11 @@ credits = [
     '2020 Facebook, Inc.',
     'MIT',
     'https://raw.githubusercontent.com/facebook/jest/master/LICENSE'
+  ], [
+    'Jinja',
+    '2007-2020 Pallets',
+    'BSD',
+    'https://github.com/pallets/jinja/blob/master/LICENSE.rst'
   ], [
     'jQuery',
     'Packt Publishing<br>&copy; jQuery Foundation and other contributors',
@@ -826,6 +836,11 @@ credits = [
     'JS Foundation and other contributors',
     'CC BY',
     'https://creativecommons.org/licenses/by/4.0/'
+  ], [
+    'Werkzeug',
+    '2007-2020 Pallets',
+    'BSD',
+    'https://github.com/pallets/werkzeug/blob/master/LICENSE.rst'
   ], [
     'Wordpress',
     '2003-2019 WordPress Foundation',
diff --git a/lib/docs/filters/flask/entries.rb b/lib/docs/filters/flask/entries.rb
new file mode 100755
index 00000000..be71c24a
--- /dev/null
+++ b/lib/docs/filters/flask/entries.rb
@@ -0,0 +1,82 @@
+module Docs
+  class Flask
+    class EntriesFilter < Docs::EntriesFilter
+      TYPE_BY_SLUG = {}
+
+      def call
+        if root_page?
+          css('.section').each do |node|
+            type = node.at_css('h2').content[0..-2]
+            node.css('li > a').each do |n|
+              s = n['href'].split('/')[-2]
+              TYPE_BY_SLUG[s] = type
+            end
+          end
+        end
+        super
+      end
+
+      def get_name
+        at_css('h1').content[0..-2]
+      end
+
+      def get_type
+        case slug
+        when /deploying/
+          'User\'s Guide: Deploying'
+        when /patterns/
+          'User\'s Guide: Design Patterns'
+        else
+          TYPE_BY_SLUG[slug.split('/').first] || 'Other'
+        end
+      end
+
+      def include_default_entry?
+        slug != 'api/'
+      end
+
+      def additional_entries
+        entries = []
+        css('dl.function > dt[id]').each do |node|
+          name = node['id'].split('.').last + '()'
+          id = node['id']
+          type = node['id'].split('.')[0..-2].join('.')
+          entries << [name, id, type]
+        end
+
+        css('dl.class > dt[id]').each do |node|
+          name = node['id'].split('.').last
+          id = node['id']
+          type = node['id'].split('.')[0..-2].join('.')
+          entries << [name, id, type]
+        end
+
+        css('dl.attribute > dt[id]').each do |node|
+          name = node['id'].split('.')[-2..-1].join('.')
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          type = 'flask' if type == ''
+          entries << [name, id, type]
+        end
+
+        css('dl.data > dt[id]').each do |node|
+          name = node['id']
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          type = 'flask' if type == ''
+          type = 'Configuration' if slug == 'config/'
+          entries << [name, id, type]
+        end
+
+        css('dl.method > dt[id]').each do |node|
+          name = node['id'].split('.')[-2..-1].join('.') + '()'
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          entries << [name, id, type]
+        end
+        entries
+      end
+
+    end
+  end
+end
diff --git a/lib/docs/filters/jinja/entries.rb b/lib/docs/filters/jinja/entries.rb
new file mode 100755
index 00000000..78a348c7
--- /dev/null
+++ b/lib/docs/filters/jinja/entries.rb
@@ -0,0 +1,55 @@
+module Docs
+  class Jinja
+    class EntriesFilter < Docs::EntriesFilter
+
+      def get_name
+        at_css('h1').content[0..-2]
+      end
+
+      def get_type
+        'User Guide'
+      end
+
+      def include_default_entry?
+        slug != 'api/'
+      end
+
+      def additional_entries
+        entries = []
+        css('dl.function > dt[id]').each do |node|
+          name = node['id'].split('.').last + '()'
+          id = node['id']
+          type = node['id'].split('.')[0..-2].join('.')
+          type = 'Template Language' if slug == 'templates/'
+          entries << [name, id, type]
+        end
+
+        css('dl.class > dt[id], dl.exception > dt[id]').each do |node|
+          name = node['id'].split('.').last
+          id = node['id']
+          type = node['id'].split('.')[0..-2].join('.')
+          type = 'Template Language' if slug == 'templates/'
+          entries << [name, id, type]
+        end
+
+        css('dl.attribute > dt[id], dl.property > dt[id]').each do |node|
+          name = node['id'].split('.')[-2..-1].join('.')
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          type = 'Template Language' if slug == 'templates/'
+          entries << [name, id, type]
+        end
+
+        css('dl.method > dt[id]').each do |node|
+          name = node['id'].split('.')[-2..-1].join('.') + '()'
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          type = 'Template Language' if slug == 'templates/'
+          entries << [name, id, type]
+        end
+        entries
+      end
+
+    end
+  end
+end
diff --git a/lib/docs/filters/werkzeug/entries.rb b/lib/docs/filters/werkzeug/entries.rb
new file mode 100755
index 00000000..78e0ec64
--- /dev/null
+++ b/lib/docs/filters/werkzeug/entries.rb
@@ -0,0 +1,61 @@
+module Docs
+  class Werkzeug
+    class EntriesFilter < Docs::EntriesFilter
+      TYPE_BY_SLUG = {}
+
+      def call
+        if root_page?
+          css('.section').each do |node|
+            type = node.at_css('h2').content[0..-2]
+            node.css('li > a').each do |n|
+              s = n['href'].split('/')[-2]
+              TYPE_BY_SLUG[s] = type
+            end
+          end
+        end
+        super
+      end
+
+      def get_name
+        at_css('h1').content[0..-2]
+      end
+
+      def get_type
+        TYPE_BY_SLUG[slug.split('/').first] || 'Other'
+      end
+
+      def additional_entries
+        entries = []
+        css('dl.function > dt[id]').each do |node|
+          name = node['id'].split('.').last + '()'
+          id = node['id']
+          type = node['id'].split('.')[0..-2].join('.')
+          entries << [name, id, type]
+        end
+
+        css('dl.class > dt[id]').each do |node|
+          name = node['id'].split('.').last
+          id = node['id']
+          type = node['id'].split('.')[0..-2].join('.')
+          entries << [name, id, type]
+        end
+
+        css('dl.attribute > dt[id]').each do |node|
+          name = node['id'].split('.')[-2..-1].join('.')
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          entries << [name, id, type]
+        end
+
+        css('dl.method > dt[id], dl.classmethod > dt[id], dl.staticmethod > dt[id]').each do |node|
+          name = node['id'].split('.')[-2..-1].join('.') + '()'
+          id = node['id']
+          type = node['id'].split('.')[0..-3].join('.')
+          entries << [name, id, type]
+        end
+        entries
+      end
+
+    end
+  end
+end
diff --git a/lib/docs/scrapers/flask.rb b/lib/docs/scrapers/flask.rb
new file mode 100755
index 00000000..2d3c0802
--- /dev/null
+++ b/lib/docs/scrapers/flask.rb
@@ -0,0 +1,40 @@
+module Docs
+  class Flask < UrlScraper
+    self.type = 'sphinx'
+    self.root_path = 'index.html'
+    self.links = {
+      home: 'https://palletsprojects.com/p/flask/',
+      code: 'https://github.com/pallets/flask'
+    }
+
+    html_filters.push 'flask/entries', 'sphinx/clean_html'
+
+    options[:container] = '.body > .section'
+    options[:skip] = %w(extensiondev/ styleguide/ upgrading/ changelog/ license/ contributing/)
+    options[:skip_patterns] = [/\Atutorial\//]
+
+    options[:attribution] = <<-HTML
+      &copy; 2007&ndash;2020 Pallets<br>
+      Licensed under the BSD 3-clause License.
+    HTML
+
+    version '1.1' do
+      self.release = '1.1.x'
+      self.base_url = "https://flask.palletsprojects.com/en/#{self.release}/";
+    end
+
+    version '1.0' do
+      self.release = '1.0.x'
+      self.base_url = "https://flask.palletsprojects.com/en/#{self.release}/";
+    end
+
+    version '0.12' do
+      self.release = '0.12.x'
+      self.base_url = "https://flask.palletsprojects.com/en/#{self.release}/";
+    end
+
+    def get_latest_version(opts)
+      get_latest_github_release('pallets', 'flask', opts)
+    end
+  end
+end
diff --git a/lib/docs/scrapers/jinja.rb b/lib/docs/scrapers/jinja.rb
new file mode 100755
index 00000000..f38af56d
--- /dev/null
+++ b/lib/docs/scrapers/jinja.rb
@@ -0,0 +1,39 @@
+module Docs
+  class Jinja < UrlScraper
+    self.type = 'sphinx'
+    self.root_path = 'index.html'
+    self.links = {
+      home: 'https://palletsprojects.com/p/jinja/',
+      code: 'https://github.com/pallets/jinja'
+    }
+
+    html_filters.push 'jinja/entries', 'sphinx/clean_html'
+
+    options[:container] = '.body > .section'
+    options[:skip] = %w(integration/ switching/ faq/ changelog/ search/ genindex/)
+
+    options[:attribution] = <<-HTML
+      &copy; 2007&ndash;2020 Pallets<br>
+      Licensed under the BSD 3-clause License.
+    HTML
+
+    version '2.11' do
+      self.release = '2.11.x'
+      self.base_url = "https://jinja.palletsprojects.com/en/#{self.release}/";
+    end
+
+    version '2.10' do
+      self.release = '2.10.x'
+      self.base_url = "https://jinja.palletsprojects.com/en/#{self.release}/";
+    end
+
+    version '2.9' do
+      self.release = '2.9.x'
+      self.base_url = "https://jinja.palletsprojects.com/en/#{self.release}/";
+    end
+
+    def get_latest_version(opts)
+      get_latest_github_release('pallets', 'jinja', opts)
+    end
+  end
+end
diff --git a/lib/docs/scrapers/werkzeug.rb b/lib/docs/scrapers/werkzeug.rb
new file mode 100755
index 00000000..b610659c
--- /dev/null
+++ b/lib/docs/scrapers/werkzeug.rb
@@ -0,0 +1,39 @@
+module Docs
+  class Werkzeug < UrlScraper
+    self.type = 'sphinx'
+    self.root_path = 'index.html'
+    self.links = {
+      home: 'https://palletsprojects.com/p/werkzeug/',
+      code: 'https://github.com/pallets/werkzeug'
+    }
+
+    html_filters.push 'werkzeug/entries', 'sphinx/clean_html'
+
+    options[:container] = '.body > .section'
+    options[:skip] = %w(changes/)
+
+    options[:attribution] = <<-HTML
+      &copy; 2007&ndash;2020 Pallets<br>
+      Licensed under the BSD 3-clause License.
+    HTML
+
+    version '1.0' do
+      self.release = '1.0.x'
+      self.base_url = "https://werkzeug.palletsprojects.com/en/#{self.release}/";
+    end
+
+    version '0.16' do
+      self.release = '0.16.x'
+      self.base_url = "https://werkzeug.palletsprojects.com/en/#{self.release}/";
+    end
+
+    version '0.15' do
+      self.release = '0.15.x'
+      self.base_url = "https://werkzeug.palletsprojects.com/en/#{self.release}/";
+    end
+
+    def get_latest_version(opts)
+      get_latest_github_release('pallets', 'werkzeug', opts)
+    end
+  end
+end
diff --git a/public/icons/docs/flask/16.png b/public/icons/docs/flask/16.png
new file mode 100644
index 00000000..84bfe0c7
Binary files /dev/null and b/public/icons/docs/flask/16.png differ
diff --git a/public/icons/docs/flask/16 2x png b/public/icons/docs/flask/16 2x png
new file mode 100644
index 00000000..17ed0357
Binary files /dev/null and b/public/icons/docs/flask/16 2x png differ
diff --git a/public/icons/docs/flask/SOURCE b/public/icons/docs/flask/SOURCE
new file mode 100644
index 00000000..eb5b7a55
--- /dev/null
+++ b/public/icons/docs/flask/SOURCE
@@ -0,0 +1 @@
+https://flask.palletsprojects.com/en/1.1.x/_static/flask-icon.png
diff --git a/public/icons/docs/jinja/16.png b/public/icons/docs/jinja/16.png
new file mode 100644
index 00000000..2422b81f
Binary files /dev/null and b/public/icons/docs/jinja/16.png differ
diff --git a/public/icons/docs/jinja/16 2x png b/public/icons/docs/jinja/16 2x png
new file mode 100644
index 00000000..b10d9635
Binary files /dev/null and b/public/icons/docs/jinja/16 2x png differ
diff --git a/public/icons/docs/jinja/SOURCE b/public/icons/docs/jinja/SOURCE
new file mode 100644
index 00000000..93ed25c7
--- /dev/null
+++ b/public/icons/docs/jinja/SOURCE
@@ -0,0 +1 @@
+https://jinja.palletsprojects.com/en/2.11.x/_static/jinja-logo-sidebar.png
diff --git a/public/icons/docs/werkzeug/16.png b/public/icons/docs/werkzeug/16.png
new file mode 100644
index 00000000..16937575
Binary files /dev/null and b/public/icons/docs/werkzeug/16.png differ
diff --git a/public/icons/docs/werkzeug/16 2x png b/public/icons/docs/werkzeug/16 2x png
new file mode 100644
index 00000000..a069df95
Binary files /dev/null and b/public/icons/docs/werkzeug/16 2x png differ
diff --git a/public/icons/docs/werkzeug/SOURCE b/public/icons/docs/werkzeug/SOURCE
new file mode 100644
index 00000000..07a3d62f
--- /dev/null
+++ b/public/icons/docs/werkzeug/SOURCE
@@ -0,0 +1 @@
+https://werkzeug.palletsprojects.com/en/1.0.x/_static/favicon.ico


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