Add Vuex reference (#910)

Add Vuex reference
pull/1055/head
Jasper van Merle 6 years ago committed by GitHub
commit e760db266c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.',

@ -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

@ -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

@ -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
&copy; 2015&ndash;present Evan You<br>
Licensed under the MIT License.
HTML
def get_latest_version(opts)
get_npm_version('vuex', opts)
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1 @@
https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai
Loading…
Cancel
Save