Skip to content

Commit 40defdd

Browse files
committed
vuex: finish scraper and filters
1 parent 186932e commit 40defdd

File tree

5 files changed

+37
-32
lines changed

5 files changed

+37
-32
lines changed

assets/javascripts/templates/pages/about_tmpl.coffee

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -729,21 +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
], [
738743
'Vuex',
739-
'2015-2018 Evan You, Vue.js contributors',
744+
'2015-present Evan You',
740745
'MIT',
741-
'https://raw.githubusercontent.com/vuejs/vuex/master/LICENSE'
742-
], [
743-
'Vue Router',
744-
'2013-present Evan You',
745-
'MIT',
746-
'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE'
746+
'https://raw.githubusercontent.com/vuejs/vuex/dev/LICENSE'
747747
], [
748748
'Vulkan',
749749
'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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ class CleanHtmlFilter < Filter
44
def call
55
@doc = at_css('.content')
66

7+
# Remove video from root page
8+
css('a[href="#"]').remove if root_page?
9+
710
# Remove unneeded elements
811
css('.header-anchor').remove
912

1013
doc
1114
end
1215
end
1316
end
14-
end
17+
end

lib/docs/filters/vuex/entries.rb

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ def get_name
88

99
# Add index on guides
1010
unless subpath.start_with?('api')
11-
sidebarLink = at_css('.sidebar-link.active')
12-
allLinks = css('.sidebar-link:not([href="/"]):not([href="../index"])')
11+
sidebar_link = at_css('.sidebar-link.active')
12+
all_links = css('.sidebar-link:not([href="/"]):not([href="../index"])')
1313

14-
index = allLinks.index(sidebarLink)
14+
index = all_links.index(sidebar_link)
1515

1616
name.prepend "#{index + 1}. " if index
1717
end
@@ -28,41 +28,42 @@ def include_default_entry?
2828
end
2929

3030
def additional_entries
31-
return [] unless subpath.start_with?('api')
31+
return [] unless subpath.start_with?('api')
3232

3333
entries = [
3434
['Component Binding Helpers', 'component-binding-helpers', 'API Reference'],
3535
['Store', 'vuex-store', 'API Reference'],
3636
]
3737

3838
css('h3').each do |node|
39-
entryName = node.content.strip
39+
entry_name = node.content.strip
4040

4141
# Get the previous h2 title
4242
title = node
4343
title = title.previous_element until title.name == 'h2'
4444
title = title.content.strip
4545
title.remove! '# '
4646

47-
entryName.remove! '# '
47+
entry_name.remove! '# '
4848

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}()"
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}()"
5859
end
5960
end
6061

61-
entries << [entryName, node['id'], 'API Reference']
62+
entries << [entry_name, node['id'], 'API Reference']
6263
end
6364

6465
entries
6566
end
6667
end
6768
end
68-
end
69+
end

lib/docs/scrapers/vuex.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
module Docs
22
class Vuex < UrlScraper
3-
self.name = 'Vuex'
43
self.type = 'simple'
5-
4+
self.release = '3.1.1'
5+
self.base_url = 'https://vuex.vuejs.org/'
66
self.links = {
77
home: 'https://vuex.vuejs.org',
88
code: 'https://github.com/vuejs/vuex'
99
}
1010

1111
html_filters.push 'vuex/entries', 'vuex/clean_html'
1212

13-
self.release = '3.0.1'
14-
self.base_url = 'https://vuex.vuejs.org/'
15-
1613
options[:skip_patterns] = [
1714
# Other languages
1815
/^(zh|ja|ru|kr|fr|ptbr)\//,
1916
]
2017

2118
options[:attribution] = <<-HTML
22-
&copy; 2015&ndash;2018 Evan You, Vue.js contributors<br>
19+
&copy; 2015&ndash;present Evan You<br>
2320
Licensed under the MIT License.
2421
HTML
22+
23+
def get_latest_version(opts)
24+
get_npm_version('vuex', opts)
25+
end
2526
end
2627
end

public/icons/docs/vuex/SOURCE

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

0 commit comments

Comments
 (0)