History

Update Vuex documentation (3.6.2 and 4.0.0-rc.2)

Simon Legner committed 5 years ago

Commit bf248f01 parent 60876133 files · +21 −6Browse files

Unified · Split

3 files
  1. lib/docs/core/doc.rb +2 −2
  2. lib/docs/filters/vuex/clean_html.rb +8 −1
  3. lib/docs/scrapers/vuex.rb +11 −3
lib/docs/core/doc.rb+2−2
@@ -246,9 +246,9 @@ module Docs · 245 unmodified lines
246246 JSON.parse fetch(url, opts)
247247 end
248248
249− def get_npm_version(package, opts)
249+ def get_npm_version(package, opts, tag='latest')
250250 json = fetch_json("https://registry.npmjs.com/#{package}", opts)
251− json['dist-tags']['latest']
251+ json['dist-tags'][tag]
252252 end
253253
254254 def get_latest_github_release(owner, repo, opts)
lib/docs/filters/vuex/clean_html.rb+8−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Vuex
33 class CleanHtmlFilter < Filter
44 def call
5− @doc = at_css('.content')
5+ @doc = at_css('main')
66
77 # Remove video from root page
88 css('a[href="#"]').remove if root_page?
@@ -10,6 +10,13 @@ module Docs · 1 unmodified line
1010 # Remove unneeded elements
1111 css('.header-anchor').remove
1212
13+ # Remove data-v-* attributes
14+ css('*').each do |node|
15+ node.attributes.each_key do |attribute|
16+ node.remove_attribute(attribute) if attribute.start_with? 'data-v-'
17+ end
18+ end
19+
1320 doc
1421 end
1522 end
lib/docs/scrapers/vuex.rb+11−3
@@ -1,8 +1,6 @@
11 module Docs
22 class Vuex < UrlScraper
33 self.type = 'simple'
4− self.release = '3.1.1'
5− self.base_url = 'https://vuex.vuejs.org/'
64 self.links = {
75 home: 'https://vuex.vuejs.org',
86 code: 'https://github.com/vuejs/vuex'
@@ -20,8 +18,18 @@ module Docs · 11 unmodified lines
2018 Licensed under the MIT License.
2119 HTML
2220
21+ version '4' do
22+ self.release = '4.0.0-rc.2'
23+ self.base_url = 'https://next.vuex.vuejs.org/'
24+ end
25+
26+ version '3' do
27+ self.release = '3.6.2'
28+ self.base_url = 'https://vuex.vuejs.org/'
29+ end
30+
2331 def get_latest_version(opts)
24− get_npm_version('vuex', opts)
32+ get_npm_version('vuex', opts, 'next')
2533 end
2634 end
2735 end