Finish Vue.js scraper

pull/229/merge
Thibaut 10 years ago
parent eea35dd09e
commit f1cef991ec

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 80 KiB

@ -1,7 +1,7 @@
[ [
[ [
"2015-07-05", "2015-07-05",
"New documentations: <a href=\"/drupal/\">Drupal</a>, <a href=\"/phaser/\">Phaser</a> and <a href=\"/webpack/\">webpack</a>" "New documentations: <a href=\"/drupal/\">Drupal</a>, <a href=\"/vue/\">Vue.js</a>, <a href=\"/phaser/\">Phaser</a> and <a href=\"/webpack/\">webpack</a>"
], [ ], [
"2015-05-24", "2015-05-24",
"New <a href=\"/rust/\">Rust</a> documentation" "New <a href=\"/rust/\">Rust</a> documentation"

@ -360,6 +360,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'
], [
'Vue.js',
'2013-2015 Evan You, Vue.js contributors',
'MIT',
'https://raw.githubusercontent.com/yyx990803/vue/master/LICENSE'
], [ ], [
'Webpack', 'Webpack',
'2012-2015 Tobias Koppers', '2012-2015 Tobias Koppers',

@ -34,4 +34,5 @@ app.views.JavascriptPage
app.views.RequirejsPage = app.views.RequirejsPage =
app.views.SocketioPage = app.views.SocketioPage =
app.views.VuePage =
app.views.JavascriptWithMarkupCheckPage app.views.JavascriptWithMarkupCheckPage

@ -1,14 +0,0 @@
#= require views/pages/base
class app.views.VuePage extends app.views.BasePage
afterRender: ->
for el in @findAllByTag('pre')
lang = if el.classList.contains('html') or el.textContent[0] is '<'
'markup'
else if el.classList.contains('css')
'css'
else
'javascript'
el.setAttribute('class', '')
@highlightCode el, lang
return

@ -68,5 +68,6 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/vue',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -68,5 +68,6 @@
'pages/socketio', 'pages/socketio',
'pages/sphinx', 'pages/sphinx',
'pages/underscore', 'pages/underscore',
'pages/vue',
'pages/yard', 'pages/yard',
'pages/yii'; 'pages/yii';

@ -104,3 +104,4 @@
._icon-drupal:before { background-position: 0 -8rem; } ._icon-drupal:before { background-position: 0 -8rem; }
._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; } ._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; }
._icon-phaser:before { background-position: -2rem -8rem; } ._icon-phaser:before { background-position: -2rem -8rem; }
._icon-vue:before { background-position: -3rem -8rem; }

@ -25,7 +25,6 @@
._mocha, ._mocha,
._mongoose, ._mongoose,
._sinon, ._sinon,
._vue,
._webpack { ._webpack {
@extend %simple; @extend %simple;
} }

@ -0,0 +1,5 @@
._vue {
@extend %simple;
p.tip { @extend %note; }
}

@ -2,12 +2,19 @@ module Docs
class Vue class Vue
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
@doc = at_css('.content')
at_css('h1').content = 'Vue.js' if root_page?
css('#demo').remove
# Remove code highlighting # Remove code highlighting
css('figure').each do |node| css('figure').each do |node|
node.name = 'pre' node.name = 'pre'
node.content = node.at_css('td.code pre').css('.line').map(&:content).join("\n") node.content = node.at_css('td.code pre').css('.line').map(&:content).join("\n")
end end
css('.content')
doc
end end
end end
end end

@ -1,16 +1,25 @@
module Docs module Docs
class Vue class Vue
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').content
end
def get_type
if slug.start_with?('guide')
'Guide'
else
'API'
end
end
def additional_entries def additional_entries
type = nil return [] if slug.start_with?('guide')
doc.children.each_with_object [] do |node, entries| css('h3').map do |node|
if node.name == 'h1' name = node.content.strip
type = node.content.strip name.sub! %r{\(.*\)}, '()'
elsif node.name == 'h3' [name, node['id'], "API: #{self.name}"]
name = node.content.strip
entries << [name, node['id'], type]
end
end end
end end
end end

@ -3,16 +3,21 @@ module Docs
self.name = 'Vue.js' self.name = 'Vue.js'
self.slug = 'vue' self.slug = 'vue'
self.type = 'vue' self.type = 'vue'
self.version = '0.12.5' self.version = '0.12.6'
self.base_url = 'http://vuejs.org/api/' self.base_url = 'http://vuejs.org'
self.root_path = '/guide/index.html'
self.initial_paths = %w(/api/index.html)
self.links = {
home: 'http://vuejs.org/',
code: 'https://github.com/yyx990803/vue'
}
html_filters.push 'vue/clean_html', 'vue/entries' html_filters.push 'vue/clean_html', 'vue/entries'
options[:follow_links] = ->(filter) { filter.root_page? }
options[:only_patterns] = [/\/guide\//, /\/api\//]
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2014&ndash;2015 Evan You, Vue.js contributors<br> &copy; 2013&ndash;2015 Evan You, Vue.js contributors<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Loading…
Cancel
Save