Finish Vagrant scraper

pull/292/head
Thibaut 9 years ago
parent e6c90931d5
commit de1c879730

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 91 KiB

@ -1,7 +1,7 @@
[ [
[ [
"2015-11-08", "2015-11-08",
"New documentation: <a href=\"/elixir/\">Elixir</a>" "New documentations: <a href=\"/elixir/\">Elixir</a> and <a href=\"/vagrant/\">Vagrant</a>"
], [ ], [
"2015-10-18", "2015-10-18",
"Added a \"Copy to clipboard\" button inside each code block." "Added a \"Copy to clipboard\" button inside each code block."

@ -379,6 +379,11 @@ credits = [
'2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors', '2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
'MIT', 'MIT',
'https://raw.github.com/jashkenas/underscore/master/LICENSE' 'https://raw.github.com/jashkenas/underscore/master/LICENSE'
], [
'Vagrant',
'2010-2015 Mitchell Hashimoto',
'MIT',
'https://raw.githubusercontent.com/mitchellh/vagrant/master/LICENSE'
], [ ], [
'Vue.js', 'Vue.js',
'2013-2015 Evan You, Vue.js contributors', '2013-2015 Evan You, Vue.js contributors',

@ -0,0 +1,5 @@
#= require views/pages/base
class app.views.VagrantPage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('pre.ruby'), 'ruby'

@ -72,6 +72,7 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/vagrant',
'pages/vue', 'pages/vue',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -72,6 +72,7 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/vagrant',
'pages/vue', 'pages/vue',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -117,3 +117,4 @@
%icon-clipboard { background-position: -2rem -9rem; } %icon-clipboard { background-position: -2rem -9rem; }
%icon-clipboard-white { background-position: -3rem -9rem; } %icon-clipboard-white { background-position: -3rem -9rem; }
._icon-elixir:before { background-position: -4rem -9rem; @extend %darkIconFix !optional; } ._icon-elixir:before { background-position: -4rem -9rem; @extend %darkIconFix !optional; }
._icon-vagrant:before { background-position: -5rem -9rem; }

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

@ -2,14 +2,12 @@ module Docs
class Vagrant class Vagrant
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
if root_page? @doc = at_css('.page-contents .span8')
doc.children = css('h1, .category')
return doc
end
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 node.before(node.children).remove
end end

@ -3,59 +3,32 @@ module Docs
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
if slug.start_with?('push/') if slug.start_with?('push/')
if at_css('h2') name = at_css('h2').try(:content)
name = at_css('h2').content.strip elsif slug.start_with?('cli/')
else name = at_css('h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/)
name = at_css('h1').content.strip
end
name
else
name = at_css('h1').content.strip
name
end end
name || at_css('h1').content
end end
def get_type def get_type
if slug.start_with?('why-vagrant') at_css('.sidebar-nav li.current').content
'Why Vagrant?' end
elsif slug.start_with?('installation')
'Installation' def additional_entries
elsif slug.start_with?('getting-started') case at_css('h1 + p > strong > code').try(:content)
'Getting Started' when /config\./
elsif slug.start_with?('cli') h2 = nil
'Command-Line Interface' css('.page-contents .span8 > *').each_with_object [] do |node, entries|
elsif slug.start_with?('share') if node.name == 'h2'
'Vagrant Share' h2 = node.content
elsif slug.start_with?('vagrantfile') elsif h2 == 'Available Settings' && (code = node.at_css('code')) && (name = code.content) && name.start_with?('config.')
'Vagrantfile' id = code.parent['id'] = name.parameterize
elsif slug.start_with?('boxes') entries << [name, id, 'Config']
'Boxes' end
elsif slug.start_with?('provisioning') end
'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'
else else
'Overview' []
end end
end end
end end

@ -1,15 +1,15 @@
module Docs module Docs
class Vagrant < UrlScraper class Vagrant < UrlScraper
self.name = 'Vagrant' self.name = 'Vagrant'
self.slug = 'vagrant'
self.type = 'vagrant' self.type = 'vagrant'
self.version = '1.7.4' self.version = '1.7.4'
self.base_url = 'http://docs.vagrantup.com/v2/' self.base_url = 'https://docs.vagrantup.com/v2/'
self.links = { 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 options[:attribution] = <<-HTML
&copy; 2010&ndash;2015 Mitchell Hashimoto<br> &copy; 2010&ndash;2015 Mitchell Hashimoto<br>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Loading…
Cancel
Save