From 9b655f2ee53e5bca3e6030dbc36b9b58f865f8e2 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Mon, 22 May 2017 11:26:56 -0400 Subject: [PATCH] Update Vagrant documentation (1.9.5) --- assets/stylesheets/application-dark.css.scss | 1 - assets/stylesheets/application.css.scss | 1 - assets/stylesheets/pages/_simple.scss | 1 + assets/stylesheets/pages/_vagrant.scss | 9 --------- lib/docs/filters/vagrant/clean_html.rb | 16 +++++++++++----- lib/docs/filters/vagrant/entries.rb | 14 ++++++++------ lib/docs/scrapers/vagrant.rb | 2 +- 7 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 assets/stylesheets/pages/_vagrant.scss diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index bec52cb0..f1ec234e 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -94,7 +94,6 @@ 'pages/tcl_tk', 'pages/tensorflow', 'pages/underscore', - 'pages/vagrant', 'pages/vue', 'pages/webpack', 'pages/yard', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 8b79deab..f24534ac 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -94,7 +94,6 @@ 'pages/tcl_tk', 'pages/tensorflow', 'pages/underscore', - 'pages/vagrant', 'pages/vue', 'pages/webpack', 'pages/yard', diff --git a/assets/stylesheets/pages/_simple.scss b/assets/stylesheets/pages/_simple.scss index 1693f03f..05fe3199 100644 --- a/assets/stylesheets/pages/_simple.scss +++ b/assets/stylesheets/pages/_simple.scss @@ -38,6 +38,7 @@ ._mongoose, ._redux, ._typescript, +._vagrant, ._yarn { @extend %simple; } diff --git a/assets/stylesheets/pages/_vagrant.scss b/assets/stylesheets/pages/_vagrant.scss deleted file mode 100644 index 89b9e820..00000000 --- a/assets/stylesheets/pages/_vagrant.scss +++ /dev/null @@ -1,9 +0,0 @@ -._vagrant { - @extend %simple; - - .alert { @extend %note; } - .prev-button { float: left; } - .prev-button:before { content: '\2190 '; } - .next-button { float: right; } - .next-button:after { content: ' \2192'; } -} diff --git a/lib/docs/filters/vagrant/clean_html.rb b/lib/docs/filters/vagrant/clean_html.rb index de2fd06d..1b16613c 100644 --- a/lib/docs/filters/vagrant/clean_html.rb +++ b/lib/docs/filters/vagrant/clean_html.rb @@ -2,13 +2,19 @@ module Docs class Vagrant class CleanHtmlFilter < Filter def call - @doc = at_css('#main-content .bs-docs-section') + @doc = at_css('#inner') - css('hr').remove + css('hr', 'a.anchor').remove - css('pre > code').each do |node| - node.parent['data-language'] = 'ruby' - node.before(node.children).remove + css('.alert').each do |node| + node.name = 'blockquote' + end + + css('pre').each do |node| + if language = node['class'][/(json|shell|ruby)/, 1] + node['data-language'] = language + end + node.content = node.content end doc diff --git a/lib/docs/filters/vagrant/entries.rb b/lib/docs/filters/vagrant/entries.rb index e837a206..77e078b0 100644 --- a/lib/docs/filters/vagrant/entries.rb +++ b/lib/docs/filters/vagrant/entries.rb @@ -3,12 +3,14 @@ module Docs class EntriesFilter < Docs::EntriesFilter def get_name if slug.start_with?('push/') - name = at_css('#main-content h2').try(:content) + name = at_css('#inner h2').try(:content) elsif slug.start_with?('cli/') - name = at_css('#main-content h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/) + name = at_css('#inner h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/) end - name || at_css('#main-content h1').content + name ||= at_css('#inner h1').content + name.remove! "ยป " + name end def get_type @@ -22,11 +24,11 @@ module Docs case at_css('h1 + p > strong > code').try(:content) when /config\./ h2 = nil - css('#main-content .bs-docs-section > *').each_with_object [] do |node, entries| + css('#inner > *').each_with_object [] do |node, entries| next if node.name == 'pre' if node.name == 'h2' - h2 = node.content - elsif h2 == 'Available Settings' && (code = node.at_css('code')) && (name = code.content) && name.start_with?('config.') + h2 = node['id'] + elsif h2 == 'available-settings' && (code = node.at_css('code')) && (name = code.content) && name.start_with?('config.') id = code.parent['id'] = name.parameterize entries << [name, id, 'Config'] end diff --git a/lib/docs/scrapers/vagrant.rb b/lib/docs/scrapers/vagrant.rb index 8bad584c..d75a7574 100644 --- a/lib/docs/scrapers/vagrant.rb +++ b/lib/docs/scrapers/vagrant.rb @@ -2,7 +2,7 @@ module Docs class Vagrant < UrlScraper self.name = 'Vagrant' self.type = 'vagrant' - self.release = '1.9.2' + self.release = '1.9.5' self.base_url = 'https://www.vagrantup.com/docs/' self.root_path = 'index.html' self.links = {