Showing the changes to lib (3 of 8 files). Show all
Unified · Split
| @@ -0,0 +1,14 @@ | |||
| 1 | module 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 | ||
| 14 | end | ||
| @@ -0,0 +1,18 @@ | |||
| 1 | module 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 | ||
| 18 | end | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | module 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 | © 2014–2015 Evan You, Vue.js contributors<br> | ||
| 16 | Licensed under the MIT License. | ||
| 17 | HTML | ||
| 18 | end | ||
| 19 | end | ||