[devdocsgjs/main: 446/1867] Add Vuex reference




commit 57232ce130a64eceded02b89fb38e64523e4db3a
Author: Nicolas Ettlin <nicolas ettlin me com>
Date:   Wed Oct 17 21:21:21 2018 +0200

    Add Vuex reference

 .../javascripts/templates/pages/about_tmpl.coffee  |   5 ++
 lib/docs/filters/vuex/clean_html.rb                |  14 +++++
 lib/docs/filters/vuex/entries.rb                   |  68 +++++++++++++++++++++
 lib/docs/scrapers/vuex.rb                          |  26 ++++++++
 public/icons/docs/vuex/16.png                      | Bin 0 -> 534 bytes
 public/icons/docs/vuex/16 2x png                   | Bin 0 -> 1244 bytes
 public/icons/docs/vuex/SOURCE                      |   1 +
 7 files changed, 114 insertions(+)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index fef9a024..72fb74cd 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -680,6 +680,11 @@ credits = [
     '2013-2018 Evan You, Vue.js contributors',
     'MIT',
     'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
+  ], [
+    'Vuex',
+    '2015-2018 Evan You, Vue.js contributors',
+    'MIT',
+    'https://raw.githubusercontent.com/vuejs/vuex/master/LICENSE'
   ], [
     'Vulkan',
     '2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos 
Group Inc.',
diff --git a/lib/docs/filters/vuex/clean_html.rb b/lib/docs/filters/vuex/clean_html.rb
new file mode 100644
index 00000000..f62870cc
--- /dev/null
+++ b/lib/docs/filters/vuex/clean_html.rb
@@ -0,0 +1,14 @@
+module Docs
+  class Vuex
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('.content')
+
+        # Remove unneeded elements
+        css('.header-anchor').remove
+
+        doc
+      end
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/docs/filters/vuex/entries.rb b/lib/docs/filters/vuex/entries.rb
new file mode 100644
index 00000000..72c8486e
--- /dev/null
+++ b/lib/docs/filters/vuex/entries.rb
@@ -0,0 +1,68 @@
+module Docs
+  class Vuex
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        name = at_css('h1').content
+
+        name.remove! '# '
+
+        # Add index on guides
+        unless subpath.start_with?('api')
+          sidebarLink = at_css('.sidebar-link.active')
+          allLinks = css('.sidebar-link:not([href="/"]):not([href="../index"])')
+
+          index = allLinks.index(sidebarLink)
+
+          name.prepend "#{index + 1}. " if index
+        end
+
+        name
+      end
+
+      def get_type
+        'Guide'
+      end
+
+      def include_default_entry?
+        name != 'API Reference'
+      end
+
+      def additional_entries
+        return [] unless subpath.start_with?('api') 
+
+        entries = [
+          ['Component Binding Helpers', 'component-binding-helpers', 'API Reference'],
+          ['Store', 'vuex-store', 'API Reference'],
+        ]
+
+        css('h3').each do |node|
+          entryName = node.content.strip
+
+          # Get the previous h2 title
+          title = node
+          title = title.previous_element until title.name == 'h2'
+          title = title.content.strip
+          title.remove! '# '
+
+          entryName.remove! '# '
+
+          unless entryName.start_with?('router.')
+            if title == "Vuex.Store Constructor Options"
+              entryName = "StoreOptions.#{entryName}"
+            elsif title == "Vuex.Store Instance Properties"
+              entryName = "Vuex.Store.#{entryName}"
+            elsif title == "Vuex.Store Instance Methods"
+              entryName = "Vuex.Store.#{entryName}()"
+            elsif title == "Component Binding Helpers"
+              entryName = "#{entryName}()"
+            end
+          end
+
+          entries << [entryName, node['id'], 'API Reference']
+        end
+
+        entries
+      end
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/docs/scrapers/vuex.rb b/lib/docs/scrapers/vuex.rb
new file mode 100644
index 00000000..774e989f
--- /dev/null
+++ b/lib/docs/scrapers/vuex.rb
@@ -0,0 +1,26 @@
+module Docs
+  class Vuex < UrlScraper
+    self.name = 'Vuex'
+    self.type = 'simple'
+
+    self.links = {
+      home: 'https://vuex.vuejs.org',
+      code: 'https://github.com/vuejs/vuex'
+    }
+
+    html_filters.push 'vuex/entries', 'vuex/clean_html'
+
+    self.release = '3.0.1'
+    self.base_url = 'https://vuex.vuejs.org/'
+
+    options[:skip_patterns] = [
+      # Other languages
+      /^(zh|ja|ru|kr|fr|ptbr)\//,
+    ]
+
+    options[:attribution] = <<-HTML
+      &copy; 2015&ndash;2018 Evan You, Vue.js contributors<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end
diff --git a/public/icons/docs/vuex/16.png b/public/icons/docs/vuex/16.png
new file mode 100644
index 00000000..153c58cd
Binary files /dev/null and b/public/icons/docs/vuex/16.png differ
diff --git a/public/icons/docs/vuex/16 2x png b/public/icons/docs/vuex/16 2x png
new file mode 100644
index 00000000..7a277fae
Binary files /dev/null and b/public/icons/docs/vuex/16 2x png differ
diff --git a/public/icons/docs/vuex/SOURCE b/public/icons/docs/vuex/SOURCE
new file mode 100644
index 00000000..97bd9e03
--- /dev/null
+++ b/public/icons/docs/vuex/SOURCE
@@ -0,0 +1 @@
+http://vuejs.org/


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