vuex: finish scraper and filters

pull/910/head
Jasper van Merle 6 years ago
parent 186932e44b
commit 40defddb6c

@ -729,6 +729,11 @@ credits = [
'2010-2018 Mitchell Hashimoto', '2010-2018 Mitchell Hashimoto',
'MPL', 'MPL',
'https://raw.githubusercontent.com/mitchellh/vagrant/master/website/LICENSE.md' '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', 'Vue.js',
'2013-2018 Evan You, Vue.js contributors', '2013-2018 Evan You, Vue.js contributors',
@ -736,14 +741,9 @@ credits = [
'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE' 'https://raw.githubusercontent.com/vuejs/vue/master/LICENSE'
], [ ], [
'Vuex', 'Vuex',
'2015-2018 Evan You, Vue.js contributors', '2015-present Evan You',
'MIT', 'MIT',
'https://raw.githubusercontent.com/vuejs/vuex/master/LICENSE' 'https://raw.githubusercontent.com/vuejs/vuex/dev/LICENSE'
], [
'Vue Router',
'2013-present Evan You',
'MIT',
'https://raw.githubusercontent.com/vuejs/vue-router/dev/LICENSE'
], [ ], [
'Vulkan', 'Vulkan',
'2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.', '2014-2017 Khronos Group Inc.<br>Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.',

@ -4,6 +4,9 @@ module Docs
def call def call
@doc = at_css('.content') @doc = at_css('.content')
# Remove video from root page
css('a[href="#"]').remove if root_page?
# Remove unneeded elements # Remove unneeded elements
css('.header-anchor').remove css('.header-anchor').remove
@ -11,4 +14,4 @@ module Docs
end end
end end
end end
end end

@ -8,10 +8,10 @@ module Docs
# Add index on guides # Add index on guides
unless subpath.start_with?('api') unless subpath.start_with?('api')
sidebarLink = at_css('.sidebar-link.active') sidebar_link = at_css('.sidebar-link.active')
allLinks = css('.sidebar-link:not([href="/"]):not([href="../index"])') all_links = css('.sidebar-link:not([href="/"]):not([href="../index"])')
index = allLinks.index(sidebarLink) index = all_links.index(sidebar_link)
name.prepend "#{index + 1}. " if index name.prepend "#{index + 1}. " if index
end end
@ -28,7 +28,7 @@ module Docs
end end
def additional_entries def additional_entries
return [] unless subpath.start_with?('api') return [] unless subpath.start_with?('api')
entries = [ entries = [
['Component Binding Helpers', 'component-binding-helpers', 'API Reference'], ['Component Binding Helpers', 'component-binding-helpers', 'API Reference'],
@ -36,7 +36,7 @@ module Docs
] ]
css('h3').each do |node| css('h3').each do |node|
entryName = node.content.strip entry_name = node.content.strip
# Get the previous h2 title # Get the previous h2 title
title = node title = node
@ -44,25 +44,26 @@ module Docs
title = title.content.strip title = title.content.strip
title.remove! '# ' title.remove! '# '
entryName.remove! '# ' entry_name.remove! '# '
unless entryName.start_with?('router.') unless entry_name.start_with?('router.')
if title == "Vuex.Store Constructor Options" case title
entryName = "StoreOptions.#{entryName}" when "Vuex.Store Constructor Options"
elsif title == "Vuex.Store Instance Properties" entry_name = "StoreOptions.#{entry_name}"
entryName = "Vuex.Store.#{entryName}" when "Vuex.Store Instance Properties"
elsif title == "Vuex.Store Instance Methods" entry_name = "Vuex.Store.#{entry_name}"
entryName = "Vuex.Store.#{entryName}()" when "Vuex.Store Instance Methods"
elsif title == "Component Binding Helpers" entry_name = "Vuex.Store.#{entry_name}()"
entryName = "#{entryName}()" when "Component Binding Helpers"
entry_name = "#{entry_name}()"
end end
end end
entries << [entryName, node['id'], 'API Reference'] entries << [entry_name, node['id'], 'API Reference']
end end
entries entries
end end
end end
end end
end end

@ -1,8 +1,8 @@
module Docs module Docs
class Vuex < UrlScraper class Vuex < UrlScraper
self.name = 'Vuex'
self.type = 'simple' self.type = 'simple'
self.release = '3.1.1'
self.base_url = 'https://vuex.vuejs.org/'
self.links = { self.links = {
home: 'https://vuex.vuejs.org', home: 'https://vuex.vuejs.org',
code: 'https://github.com/vuejs/vuex' code: 'https://github.com/vuejs/vuex'
@ -10,17 +10,18 @@ module Docs
html_filters.push 'vuex/entries', 'vuex/clean_html' html_filters.push 'vuex/entries', 'vuex/clean_html'
self.release = '3.0.1'
self.base_url = 'https://vuex.vuejs.org/'
options[:skip_patterns] = [ options[:skip_patterns] = [
# Other languages # Other languages
/^(zh|ja|ru|kr|fr|ptbr)\//, /^(zh|ja|ru|kr|fr|ptbr)\//,
] ]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2015&ndash;2018 Evan You, Vue.js contributors<br> &copy; 2015&ndash;present Evan You<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
def get_latest_version(opts)
get_npm_version('vuex', opts)
end
end end
end end

@ -1 +1 @@
http://vuejs.org/ https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai

Loading…
Cancel
Save