diff --git a/lib/docs/core/doc.rb b/lib/docs/core/doc.rb index 5eae27aa..88080328 100644 --- a/lib/docs/core/doc.rb +++ b/lib/docs/core/doc.rb @@ -246,9 +246,9 @@ module Docs JSON.parse fetch(url, opts) end - def get_npm_version(package, opts) + def get_npm_version(package, opts, tag='latest') json = fetch_json("https://registry.npmjs.com/#{package}", opts) - json['dist-tags']['latest'] + json['dist-tags'][tag] end def get_latest_github_release(owner, repo, opts) diff --git a/lib/docs/filters/vuex/clean_html.rb b/lib/docs/filters/vuex/clean_html.rb index 4aad55a9..e6875441 100644 --- a/lib/docs/filters/vuex/clean_html.rb +++ b/lib/docs/filters/vuex/clean_html.rb @@ -2,7 +2,7 @@ module Docs class Vuex class CleanHtmlFilter < Filter def call - @doc = at_css('.content') + @doc = at_css('main') # Remove video from root page css('a[href="#"]').remove if root_page? @@ -10,6 +10,13 @@ module Docs # Remove unneeded elements css('.header-anchor').remove + # Remove data-v-* attributes + css('*').each do |node| + node.attributes.each_key do |attribute| + node.remove_attribute(attribute) if attribute.start_with? 'data-v-' + end + end + doc end end diff --git a/lib/docs/scrapers/vuex.rb b/lib/docs/scrapers/vuex.rb index 57e761ce..223d9854 100644 --- a/lib/docs/scrapers/vuex.rb +++ b/lib/docs/scrapers/vuex.rb @@ -1,8 +1,6 @@ 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' @@ -20,8 +18,18 @@ module Docs Licensed under the MIT License. HTML + version '4' do + self.release = '4.0.0-rc.2' + self.base_url = 'https://next.vuex.vuejs.org/' + end + + version '3' do + self.release = '3.6.2' + self.base_url = 'https://vuex.vuejs.org/' + end + def get_latest_version(opts) - get_npm_version('vuex', opts) + get_npm_version('vuex', opts, 'next') end end end