diff --git a/assets/images/icons.png b/assets/images/icons.png index d7340fa7..fa4b94f9 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index 67730587..45385ad2 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 62501ce6..770a47a7 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2015-11-08", - "New documentation: Elixir" + "New documentations: Elixir and Vagrant" ], [ "2015-10-18", "Added a \"Copy to clipboard\" button inside each code block." diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 062d4d0d..5447df0e 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -379,6 +379,11 @@ credits = [ '2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors', 'MIT', 'https://raw.github.com/jashkenas/underscore/master/LICENSE' + ], [ + 'Vagrant', + '2010-2015 Mitchell Hashimoto', + 'MIT', + 'https://raw.githubusercontent.com/mitchellh/vagrant/master/LICENSE' ], [ 'Vue.js', '2013-2015 Evan You, Vue.js contributors', diff --git a/assets/javascripts/views/pages/vagrant.coffee b/assets/javascripts/views/pages/vagrant.coffee new file mode 100644 index 00000000..49540958 --- /dev/null +++ b/assets/javascripts/views/pages/vagrant.coffee @@ -0,0 +1,5 @@ +#= require views/pages/base + +class app.views.VagrantPage extends app.views.BasePage + prepare: -> + @highlightCode @findAll('pre.ruby'), 'ruby' diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index acb915b0..e77843e1 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -72,6 +72,7 @@ 'pages/socketio', 'pages/sphinx', 'pages/underscore', + 'pages/vagrant', 'pages/vue', 'pages/yard', 'pages/yii'; diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index a262f124..ccb23a53 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -72,6 +72,7 @@ 'pages/socketio', 'pages/sphinx', 'pages/underscore', + 'pages/vagrant', 'pages/vue', 'pages/yard', 'pages/yii'; diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 51431421..4939c8b3 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -117,3 +117,4 @@ %icon-clipboard { background-position: -2rem -9rem; } %icon-clipboard-white { background-position: -3rem -9rem; } ._icon-elixir:before { background-position: -4rem -9rem; @extend %darkIconFix !optional; } +._icon-vagrant:before { background-position: -5rem -9rem; } diff --git a/assets/stylesheets/pages/_vagrant.scss b/assets/stylesheets/pages/_vagrant.scss new file mode 100644 index 00000000..89b9e820 --- /dev/null +++ b/assets/stylesheets/pages/_vagrant.scss @@ -0,0 +1,9 @@ +._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 30516650..679fa800 100644 --- a/lib/docs/filters/vagrant/clean_html.rb +++ b/lib/docs/filters/vagrant/clean_html.rb @@ -2,14 +2,12 @@ module Docs class Vagrant class CleanHtmlFilter < Filter def call - if root_page? - doc.children = css('h1, .category') - return doc - end + @doc = at_css('.page-contents .span8') - css('nav', '.sidebar', 'footer').remove + css('hr').remove - css('.wrapper', '.page', '.container', '.row', '.page-contents', '.span8').each do |node| + css('pre > code').each do |node| + node.parent['class'] = node['class'] node.before(node.children).remove end diff --git a/lib/docs/filters/vagrant/entries.rb b/lib/docs/filters/vagrant/entries.rb index 6ff89757..861067f7 100644 --- a/lib/docs/filters/vagrant/entries.rb +++ b/lib/docs/filters/vagrant/entries.rb @@ -3,59 +3,32 @@ module Docs class EntriesFilter < Docs::EntriesFilter def get_name if slug.start_with?('push/') - if at_css('h2') - name = at_css('h2').content.strip - else - name = at_css('h1').content.strip - end - name - else - name = at_css('h1').content.strip - name + name = at_css('h2').try(:content) + elsif slug.start_with?('cli/') + name = at_css('h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/) end + + name || at_css('h1').content end def get_type - if slug.start_with?('why-vagrant') - 'Why Vagrant?' - elsif slug.start_with?('installation') - 'Installation' - elsif slug.start_with?('getting-started') - 'Getting Started' - elsif slug.start_with?('cli') - 'Command-Line Interface' - elsif slug.start_with?('share') - 'Vagrant Share' - elsif slug.start_with?('vagrantfile') - 'Vagrantfile' - elsif slug.start_with?('boxes') - 'Boxes' - elsif slug.start_with?('provisioning') - 'Provisioning' - elsif slug.start_with?('networking') - 'Networking' - elsif slug.start_with?('synced-folders') - 'Synced Folders' - elsif slug.start_with?('multi-machine') - 'Multi-Machine' - elsif slug.start_with?('providers') - 'Providers' - elsif slug.start_with?('plugins') - 'Plugins' - elsif slug.start_with?('push') - 'Push' - elsif slug.start_with?('other') - 'Other' - elsif slug.start_with?('vmware') - 'VMware' - elsif slug.start_with?('docker') - 'Docker' - elsif slug.start_with?('virtualbox') - 'VirtualBox' - elsif slug.start_with?('hyperv') - 'Hyper-V' + at_css('.sidebar-nav li.current').content + end + + def additional_entries + case at_css('h1 + p > strong > code').try(:content) + when /config\./ + h2 = nil + css('.page-contents .span8 > *').each_with_object [] do |node, entries| + if node.name == 'h2' + h2 = node.content + 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 + end else - 'Overview' + [] end end end diff --git a/lib/docs/scrapers/vagrant.rb b/lib/docs/scrapers/vagrant.rb index c0fc8010..bb9f53f8 100644 --- a/lib/docs/scrapers/vagrant.rb +++ b/lib/docs/scrapers/vagrant.rb @@ -1,15 +1,15 @@ module Docs class Vagrant < UrlScraper self.name = 'Vagrant' - self.slug = 'vagrant' self.type = 'vagrant' self.version = '1.7.4' - self.base_url = 'http://docs.vagrantup.com/v2/' + self.base_url = 'https://docs.vagrantup.com/v2/' self.links = { - home: 'http://www.vagrantup.com/' + home: 'https://www.vagrantup.com/', + code: 'https://github.com/mitchellh/vagrant' } - html_filters.push 'vagrant/clean_html', 'vagrant/entries' + html_filters.push 'vagrant/entries', 'vagrant/clean_html' options[:attribution] = <<-HTML © 2010–2015 Mitchell Hashimoto
diff --git a/public/icons/docs/vagrant/16.png b/public/icons/docs/vagrant/16.png index 9c111f32..0ec6434f 100644 Binary files a/public/icons/docs/vagrant/16.png and b/public/icons/docs/vagrant/16.png differ diff --git a/public/icons/docs/vagrant/16@2x.png b/public/icons/docs/vagrant/16@2x.png index d9425c65..80ef3f19 100644 Binary files a/public/icons/docs/vagrant/16@2x.png and b/public/icons/docs/vagrant/16@2x.png differ