mirror of https://github.com/freeCodeCamp/devdocs
commit
e760db266c
@ -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
|
||||
© 2015–present Evan You<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
|
||||
def get_latest_version(opts)
|
||||
get_npm_version('vuex', opts)
|
||||
end
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 534 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/vuejs/vuejs.org/blob/master/assets/logo.ai
|
Loading…
Reference in new issue