diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 67fade42..07c92ad8 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -729,16 +729,21 @@ credits = [ '2010-2018 Mitchell Hashimoto', 'MPL', 'https://raw.githubusercontent.com/mitchellh/vagrant/master/website/LICENSE.md' + ], [ + 'Vue Router', + '2013-present Evan You', + 'MIT', + 'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE' ], [ 'Vue.js', '2013-2018 Evan You, Vue.js contributors', 'MIT', 'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE' ], [ - 'Vue Router', - '2013-present Evan You', + 'Vuex', + '2015-present Evan You', 'MIT', - 'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE' + 'https://raw.githubusercontent.com/vuejs/vuex/dev/LICENSE' ], [ 'Vulkan', '2014-2017 Khronos Group Inc.
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..4aad55a9 --- /dev/null +++ b/lib/docs/filters/vuex/clean_html.rb @@ -0,0 +1,17 @@ +module Docs + class Vuex + class CleanHtmlFilter < Filter + def call + @doc = at_css('.content') + + # Remove video from root page + css('a[href="#"]').remove if root_page? + + # Remove unneeded elements + css('.header-anchor').remove + + doc + end + end + end +end diff --git a/lib/docs/filters/vuex/entries.rb b/lib/docs/filters/vuex/entries.rb new file mode 100644 index 00000000..04846fd2 --- /dev/null +++ b/lib/docs/filters/vuex/entries.rb @@ -0,0 +1,69 @@ +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') + sidebar_link = at_css('.sidebar-link.active') + all_links = css('.sidebar-link:not([href="/"]):not([href="../index"])') + + index = all_links.index(sidebar_link) + + 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| + entry_name = node.content.strip + + # Get the previous h2 title + title = node + title = title.previous_element until title.name == 'h2' + title = title.content.strip + title.remove! '# ' + + entry_name.remove! '# ' + + unless entry_name.start_with?('router.') + case title + when "Vuex.Store Constructor Options" + entry_name = "StoreOptions.#{entry_name}" + when "Vuex.Store Instance Properties" + entry_name = "Vuex.Store.#{entry_name}" + when "Vuex.Store Instance Methods" + entry_name = "Vuex.Store.#{entry_name}()" + when "Component Binding Helpers" + entry_name = "#{entry_name}()" + end + end + + entries << [entry_name, node['id'], 'API Reference'] + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/vuex.rb b/lib/docs/scrapers/vuex.rb new file mode 100644 index 00000000..57e761ce --- /dev/null +++ b/lib/docs/scrapers/vuex.rb @@ -0,0 +1,27 @@ +module Docs + class Vuex < UrlScraper + self.type = 'simple' + self.release = '3.1.1' + self.base_url = 'https://vuex.vuejs.org/' + self.links = { + home: 'https://vuex.vuejs.org', + code: 'https://github.com/vuejs/vuex' + } + + html_filters.push 'vuex/entries', 'vuex/clean_html' + + options[:skip_patterns] = [ + # Other languages + /^(zh|ja|ru|kr|fr|ptbr)\//, + ] + + options[:attribution] = <<-HTML + © 2015–present Evan You
+ Licensed under the MIT License. + HTML + + def get_latest_version(opts) + get_npm_version('vuex', opts) + end + 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..6999e8c5 --- /dev/null +++ b/public/icons/docs/vuex/SOURCE @@ -0,0 +1 @@ +https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai