History

Add Vuex reference

Nicolas Ettlin committed 8 years ago

Commit 57232ce1 parent 6ecd9d87 files · +112 −-2Browse files

Unified · Split

7 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  2. lib/docs/filters/vuex/clean_html.rb +14 −0
  3. lib/docs/filters/vuex/entries.rb +68 −0
  4. lib/docs/scrapers/vuex.rb +26 −0
  5. public/icons/docs/vuex/16.png +0 −0
  6. public/icons/docs/vuex/16@2x.png +0 −0
  7. public/icons/docs/vuex/SOURCE +1 −0
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -680,6 +680,11 @@ credits = [ · 679 unmodified lines
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+14−0
@@ -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+68−0
@@ -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+26−0
@@ -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+0−0

Binary file not shown.

public/icons/docs/vuex/16@2x.png+0−0

Binary file not shown.

public/icons/docs/vuex/SOURCE+1−0
@@ -0,0 +1 @@
1+http://vuejs.org/