History

Finish Vue.js scraper

Thibaut committed 11 years ago

Commit f1cef991 parent eea35dd16 files · +46 −26Browse files

Unified · Split

16 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/news.json +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/javascript.coffee +1 −0
  6. assets/javascripts/views/pages/vue.coffee +0 −14
  7. assets/stylesheets/application-dark.css.scss +1 −0
  8. assets/stylesheets/application.css.scss +1 −0
  9. assets/stylesheets/global/_icons.scss +1 −0
  10. assets/stylesheets/pages/_base.scss +0 −1
  11. assets/stylesheets/pages/_vue.scss +5 −0
  12. lib/docs/filters/vue/clean_html.rb +8 −1
  13. lib/docs/filters/vue/entries.rb +17 −8
  14. lib/docs/scrapers/vue.rb +10 −5
  15. public/icons/docs/vue/16.png +0 −0
  16. public/icons/docs/vue/16@2x.png +0 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
11 [
22 [
33 "2015-07-05",
4− "New documentations: <a href=\"/drupal/\">Drupal</a>, <a href=\"/phaser/\">Phaser</a> and <a href=\"/webpack/\">webpack</a>"
4+ "New documentations: <a href=\"/drupal/\">Drupal</a>, <a href=\"/vue/\">Vue.js</a>, <a href=\"/phaser/\">Phaser</a> and <a href=\"/webpack/\">webpack</a>"
55 ], [
66 "2015-05-24",
77 "New <a href=\"/rust/\">Rust</a> documentation"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -360,6 +360,11 @@ credits = [ · 359 unmodified lines
360360 '2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
361361 'MIT',
362362 'https://raw.github.com/jashkenas/underscore/master/LICENSE'
363+ ], [
364+ 'Vue.js',
365+ '2013-2015 Evan You, Vue.js contributors',
366+ 'MIT',
367+ 'https://raw.githubusercontent.com/yyx990803/vue/master/LICENSE'
363368 ], [
364369 'Webpack',
365370 '2012-2015 Tobias Koppers',
assets/javascripts/views/pages/javascript.coffee+1−0
@@ -34,4 +34,5 @@ app.views.JavascriptPage · 33 unmodified lines
3434
3535 app.views.RequirejsPage =
3636 app.views.SocketioPage =
37+app.views.VuePage =
3738 app.views.JavascriptWithMarkupCheckPage
assets/javascripts/views/pages/vue.coffee+0−14
@@ -1,14 +0,0 @@
1−#= require views/pages/base
2−
3−class app.views.VuePage extends app.views.BasePage
4− afterRender: ->
5− for el in @findAllByTag('pre')
6− lang = if el.classList.contains('html') or el.textContent[0] is '<'
7− 'markup'
8− else if el.classList.contains('css')
9− 'css'
10− else
11− 'javascript'
12− el.setAttribute('class', '')
13− @highlightCode el, lang
14− return
assets/stylesheets/application-dark.css.scss+1−0
@@ -68,5 +68,6 @@ · 67 unmodified lines
6868 'pages/socketio',
6969 'pages/sphinx',
7070 'pages/underscore',
71+ 'pages/vue',
7172 'pages/yard',
7273 'pages/yii';
assets/stylesheets/application.css.scss+1−0
@@ -68,5 +68,6 @@ · 67 unmodified lines
6868 'pages/socketio',
6969 'pages/sphinx',
7070 'pages/underscore',
71+ 'pages/vue',
7172 'pages/yard',
7273 'pages/yii';
assets/stylesheets/global/_icons.scss+1−0
@@ -104,3 +104,4 @@ · 103 unmodified lines
104104 ._icon-drupal:before { background-position: 0 -8rem; }
105105 ._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; }
106106 ._icon-phaser:before { background-position: -2rem -8rem; }
107+._icon-vue:before { background-position: -3rem -8rem; }
assets/stylesheets/pages/_base.scss+0−1
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525 ._mocha,
2626 ._mongoose,
2727 ._sinon,
28−._vue,
2928 ._webpack {
3029 @extend %simple;
3130 }
assets/stylesheets/pages/_vue.scss+5−0
@@ -0,0 +1,5 @@
1+._vue {
2+ @extend %simple;
3+
4+ p.tip { @extend %note; }
5+}
lib/docs/filters/vue/clean_html.rb+8−1
@@ -2,12 +2,19 @@ module Docs · 1 unmodified line
22 class Vue
33 class CleanHtmlFilter < Filter
44 def call
5+ @doc = at_css('.content')
6+
7+ at_css('h1').content = 'Vue.js' if root_page?
8+
9+ css('#demo').remove
10+
511 # Remove code highlighting
612 css('figure').each do |node|
713 node.name = 'pre'
814 node.content = node.at_css('td.code pre').css('.line').map(&:content).join("\n")
915 end
10− css('.content')
16+
17+ doc
1118 end
1219 end
1320 end
lib/docs/filters/vue/entries.rb+17−8
@@ -1,16 +1,25 @@
11 module Docs
22 class Vue
33 class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ at_css('h1').content
6+ end
7+
8+ def get_type
9+ if slug.start_with?('guide')
10+ 'Guide'
11+ else
12+ 'API'
13+ end
14+ end
15+
416 def additional_entries
5− type = nil
17+ return [] if slug.start_with?('guide')
618
7− doc.children.each_with_object [] do |node, entries|
8− if node.name == 'h1'
9− type = node.content.strip
10− elsif node.name == 'h3'
11− name = node.content.strip
12− entries << [name, node['id'], type]
13− end
19+ css('h3').map do |node|
20+ name = node.content.strip
21+ name.sub! %r{\(.*\)}, '()'
22+ [name, node['id'], "API: #{self.name}"]
1423 end
1524 end
1625 end
lib/docs/scrapers/vue.rb+10−5
@@ -3,16 +3,21 @@ module Docs · 2 unmodified lines
33 self.name = 'Vue.js'
44 self.slug = 'vue'
55 self.type = 'vue'
6− self.version = '0.12.5'
7− self.base_url = 'http://vuejs.org/api/'
8−
6+ self.version = '0.12.6'
7+ self.base_url = 'http://vuejs.org'
8+ self.root_path = '/guide/index.html'
9+ self.initial_paths = %w(/api/index.html)
10+ self.links = {
11+ home: 'http://vuejs.org/',
12+ code: 'https://github.com/yyx990803/vue'
13+ }
914
1015 html_filters.push 'vue/clean_html', 'vue/entries'
11− options[:follow_links] = ->(filter) { filter.root_page? }
1216
17+ options[:only_patterns] = [/\/guide\//, /\/api\//]
1318
1419 options[:attribution] = <<-HTML
15− &copy; 2014&ndash;2015 Evan You, Vue.js contributors<br>
20+ &copy; 2013&ndash;2015 Evan You, Vue.js contributors<br>
1621 Licensed under the MIT License.
1722 HTML
1823 end
public/icons/docs/vue/16.png+0−0

Binary file not shown.

public/icons/docs/vue/16@2x.png+0−0

Binary file not shown.