History

Add documentations for vue.js

kikyous committed 11 years ago

Commit eea35dd1 parent 6e4f56f8 files · +65 −-1Browse files

Unified · Split

8 files
  1. assets/javascripts/views/pages/vue.coffee +14 −0
  2. assets/stylesheets/pages/_base.scss +1 −1
  3. lib/docs/filters/vue/clean_html.rb +14 −0
  4. lib/docs/filters/vue/entries.rb +18 −0
  5. lib/docs/scrapers/vue.rb +19 −0
  6. public/icons/docs/vue/16.png +0 −0
  7. public/icons/docs/vue/16@2x.png +0 −0
  8. public/icons/docs/vue/SOURCE +1 −0
assets/javascripts/views/pages/vue.coffee+14−0
@@ -0,0 +1,14 @@
1#= require views/pages/base
2
3class 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/pages/_base.scss+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
25._mocha,25._mocha,
26._mongoose,26._mongoose,
27._sinon,27._sinon,
28._vue,
28._webpack {29._webpack {
29 @extend %simple;30 @extend %simple;
30}31}
31
lib/docs/filters/vue/clean_html.rb+14−0
@@ -0,0 +1,14 @@
1module Docs
2 class Vue
3 class CleanHtmlFilter < Filter
4 def call
5 # Remove code highlighting
6 css('figure').each do |node|
7 node.name = 'pre'
8 node.content = node.at_css('td.code pre').css('.line').map(&:content).join("\n")
9 end
10 css('.content')
11 end
12 end
13 end
14end
lib/docs/filters/vue/entries.rb+18−0
@@ -0,0 +1,18 @@
1module Docs
2 class Vue
3 class EntriesFilter < Docs::EntriesFilter
4 def additional_entries
5 type = nil
6
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
14 end
15 end
16 end
17 end
18end
lib/docs/scrapers/vue.rb+19−0
@@ -0,0 +1,19 @@
1module Docs
2 class Vue < UrlScraper
3 self.name = 'Vue.js'
4 self.slug = 'vue'
5 self.type = 'vue'
6 self.version = '0.12.5'
7 self.base_url = 'http://vuejs.org/api/'
8
9
10 html_filters.push 'vue/clean_html', 'vue/entries'
11 options[:follow_links] = ->(filter) { filter.root_page? }
12
13
14 options[:attribution] = <<-HTML
15 &copy; 2014&ndash;2015 Evan You, Vue.js contributors<br>
16 Licensed under the MIT License.
17 HTML
18 end
19end
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.

public/icons/docs/vue/SOURCE+1−0
@@ -0,0 +1 @@
1http://vuejs.org/