Преглед на файлове

Update Vagrant documentation (1.9.5)

Thibaut Courouble преди 8 години
родител
ревизия
9b655f2ee5

+ 0 - 1
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',

+ 0 - 1
assets/stylesheets/application.css.scss

@@ -94,7 +94,6 @@
         'pages/tcl_tk',
         'pages/tensorflow',
         'pages/underscore',
-        'pages/vagrant',
         'pages/vue',
         'pages/webpack',
         'pages/yard',

+ 1 - 0
assets/stylesheets/pages/_simple.scss

@@ -38,6 +38,7 @@
 ._mongoose,
 ._redux,
 ._typescript,
+._vagrant,
 ._yarn {
   @extend %simple;
 }

+ 0 - 9
assets/stylesheets/pages/_vagrant.scss

@@ -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'; }
-}

+ 11 - 5
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

+ 8 - 6
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

+ 1 - 1
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 = {