History

Add documentations for vue.js

kikyous committed 11 years ago

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

Showing the changes to lib/docs (3 of 8 files). Show all

Unified · Split

3 files
  1. lib/docs/filters/vue/clean_html.rb +14 −0
  2. lib/docs/filters/vue/entries.rb +18 −0
  3. lib/docs/scrapers/vue.rb +19 −0
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