Skip to content

Commit e760db2

Browse files
authored
Add Vuex reference (#910)
Add Vuex reference
2 parents b34dbb2 + 40defdd commit e760db2

File tree

7 files changed

+122
-3
lines changed

7 files changed

+122
-3
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,16 +729,21 @@ credits = [
729729
'2010-2018 Mitchell Hashimoto',
730730
'MPL',
731731
'https://raw.githubusercontent.com/mitchellh/vagrant/master/website/LICENSE.md'
732+
], [
733+
'Vue Router',
734+
'2013-present Evan You',
735+
'MIT',
736+
'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE'
732737
], [
733738
'Vue.js',
734739
'2013-2018 Evan You, Vue.js contributors',
735740
'MIT',
736741
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
737742
], [
738-
'Vue Router',
739-
'2013-present Evan You',
743+
'Vuex',
744+
'2015-present Evan You',
740745
'MIT',
741-
'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE'
746+
'https://raw.githubusercontent.com/vuejs/vuex/dev/LICENSE'
742747
], [
743748
'Vulkan',
744749
'2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.',

lib/docs/filters/vuex/clean_html.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module Docs
2+
class Vuex
3+
class CleanHtmlFilter < Filter
4+
def call
5+
@doc = at_css('.content')
6+
7+
# Remove video from root page
8+
css('a[href="#"]').remove if root_page?
9+
10+
# Remove unneeded elements
11+
css('.header-anchor').remove
12+
13+
doc
14+
end
15+
end
16+
end
17+
end

lib/docs/filters/vuex/entries.rb

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
module Docs
2+
class Vuex
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
name = at_css('h1').content
6+
7+
name.remove! '# '
8+
9+
# Add index on guides
10+
unless subpath.start_with?('api')
11+
sidebar_link = at_css('.sidebar-link.active')
12+
all_links = css('.sidebar-link:not([href="/"]):not([href="../index"])')
13+
14+
index = all_links.index(sidebar_link)
15+
16+
name.prepend "#{index + 1}. " if index
17+
end
18+
19+
name
20+
end
21+
22+
def get_type
23+
'Guide'
24+
end
25+
26+
def include_default_entry?
27+
name != 'API Reference'
28+
end
29+
30+
def additional_entries
31+
return [] unless subpath.start_with?('api')
32+
33+
entries = [
34+
['Component Binding Helpers', 'component-binding-helpers', 'API Reference'],
35+
['Store', 'vuex-store', 'API Reference'],
36+
]
37+
38+
css('h3').each do |node|
39+
entry_name = node.content.strip
40+
41+
# Get the previous h2 title
42+
title = node
43+
title = title.previous_element until title.name == 'h2'
44+
title = title.content.strip
45+
title.remove! '# '
46+
47+
entry_name.remove! '# '
48+
49+
unless entry_name.start_with?('router.')
50+
case title
51+
when "Vuex.Store Constructor Options"
52+
entry_name = "StoreOptions.#{entry_name}"
53+
when "Vuex.Store Instance Properties"
54+
entry_name = "Vuex.Store.#{entry_name}"
55+
when "Vuex.Store Instance Methods"
56+
entry_name = "Vuex.Store.#{entry_name}()"
57+
when "Component Binding Helpers"
58+
entry_name = "#{entry_name}()"
59+
end
60+
end
61+
62+
entries << [entry_name, node['id'], 'API Reference']
63+
end
64+
65+
entries
66+
end
67+
end
68+
end
69+
end

lib/docs/scrapers/vuex.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Docs
2+
class Vuex < UrlScraper
3+
self.type = 'simple'
4+
self.release = '3.1.1'
5+
self.base_url = 'https://vuex.vuejs.org/'
6+
self.links = {
7+
home: 'https://vuex.vuejs.org',
8+
code: 'https://github.com/vuejs/vuex'
9+
}
10+
11+
html_filters.push 'vuex/entries', 'vuex/clean_html'
12+
13+
options[:skip_patterns] = [
14+
# Other languages
15+
/^(zh|ja|ru|kr|fr|ptbr)\//,
16+
]
17+
18+
options[:attribution] = <<-HTML
19+
&copy; 2015&ndash;present Evan You<br>
20+
Licensed under the MIT License.
21+
HTML
22+
23+
def get_latest_version(opts)
24+
get_npm_version('vuex', opts)
25+
end
26+
end
27+
end

public/icons/docs/vuex/16.png

534 Bytes
Loading
1.21 KB
Loading

public/icons/docs/vuex/SOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai

0 commit comments

Comments
 (0)