Skip to content

Commit 57232ce

Browse files
committed
Add Vuex reference
1 parent 6ecd9d8 commit 57232ce

File tree

7 files changed

+114
-0
lines changed

7 files changed

+114
-0
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@ credits = [
680680
'2013-2018 Evan You, Vue.js contributors',
681681
'MIT',
682682
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
683+
], [
684+
'Vuex',
685+
'2015-2018 Evan You, Vue.js contributors',
686+
'MIT',
687+
'https://raw.githubusercontent.com/vuejs/vuex/master/LICENSE'
683688
], [
684689
'Vulkan',
685690
'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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Docs
2+
class Vuex
3+
class CleanHtmlFilter < Filter
4+
def call
5+
@doc = at_css('.content')
6+
7+
# Remove unneeded elements
8+
css('.header-anchor').remove
9+
10+
doc
11+
end
12+
end
13+
end
14+
end

lib/docs/filters/vuex/entries.rb

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
sidebarLink = at_css('.sidebar-link.active')
12+
allLinks = css('.sidebar-link:not([href="/"]):not([href="../index"])')
13+
14+
index = allLinks.index(sidebarLink)
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+
entryName = 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+
entryName.remove! '# '
48+
49+
unless entryName.start_with?('router.')
50+
if title == "Vuex.Store Constructor Options"
51+
entryName = "StoreOptions.#{entryName}"
52+
elsif title == "Vuex.Store Instance Properties"
53+
entryName = "Vuex.Store.#{entryName}"
54+
elsif title == "Vuex.Store Instance Methods"
55+
entryName = "Vuex.Store.#{entryName}()"
56+
elsif title == "Component Binding Helpers"
57+
entryName = "#{entryName}()"
58+
end
59+
end
60+
61+
entries << [entryName, node['id'], 'API Reference']
62+
end
63+
64+
entries
65+
end
66+
end
67+
end
68+
end

lib/docs/scrapers/vuex.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module Docs
2+
class Vuex < UrlScraper
3+
self.name = 'Vuex'
4+
self.type = 'simple'
5+
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+
self.release = '3.0.1'
14+
self.base_url = 'https://vuex.vuejs.org/'
15+
16+
options[:skip_patterns] = [
17+
# Other languages
18+
/^(zh|ja|ru|kr|fr|ptbr)\//,
19+
]
20+
21+
options[:attribution] = <<-HTML
22+
&copy; 2015&ndash;2018 Evan You, Vue.js contributors<br>
23+
Licensed under the MIT License.
24+
HTML
25+
end
26+
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+
http://vuejs.org/

0 commit comments

Comments
 (0)