devdocs/lib/docs/scrapers/ember.rb

61 lines
1.4 KiB
Ruby
Raw Normal View History

2013-10-24 20:25:52 +02:00
module Docs
class Ember < UrlScraper
include MultipleBaseUrls
2016-09-04 18:35:42 +02:00
2013-10-24 20:25:52 +02:00
self.name = 'Ember.js'
self.slug = 'ember'
self.type = 'ember'
2017-09-10 17:17:42 +02:00
self.release = '2.15.0'
2017-07-23 19:16:15 +02:00
self.base_urls = [
2017-09-10 17:17:42 +02:00
'https://guides.emberjs.com/v2.15.0/',
'https://emberjs.com/api/ember/2.15/',
2017-07-23 19:16:15 +02:00
'https://emberjs.com/api/ember-data/2.14/'
]
2015-03-29 17:18:17 +02:00
self.links = {
2017-06-25 15:42:42 +02:00
home: 'https://emberjs.com/',
2015-03-29 17:18:17 +02:00
code: 'https://github.com/emberjs/ember.js'
}
2013-10-24 20:25:52 +02:00
2017-07-23 19:16:15 +02:00
html_filters.push 'ember/entries', 'ember/clean_html'
2016-09-04 18:35:42 +02:00
options[:trailing_slash] = false
2013-10-24 20:25:52 +02:00
options[:container] = ->(filter) do
2016-09-04 18:35:42 +02:00
if filter.base_url.path.start_with?('/api')
2017-07-23 19:16:15 +02:00
'main article'
2016-09-04 18:35:42 +02:00
else
'main'
end
2013-10-24 20:25:52 +02:00
end
2017-07-23 19:16:15 +02:00
options[:fix_urls] = ->(url) do
url.sub! '?anchor=', '#'
url.sub! %r{/methods/[^?#/]+}, '/methods'
url.sub! %r{/properties/[^?#/]+}, '/properties'
url.sub! %r{/events/[^?#/]+}, '/events'
url
end
options[:skip_patterns] = [
/\._/,
/contributing/,
/classes\/String/,
/namespaces\/Ember/,
/namespaces\/DS/
]
2013-10-24 20:25:52 +02:00
options[:attribution] = <<-HTML
2017-02-05 21:52:46 +01:00
&copy; 2017 Yehuda Katz, Tom Dale and Ember.js contributors<br>
2013-10-24 20:25:52 +02:00
Licensed under the MIT License.
HTML
2017-07-23 19:16:15 +02:00
def initial_urls
%w(
2017-09-10 17:17:42 +02:00
https://guides.emberjs.com/v2.15.0/
https://emberjs.com/api/ember/2.15/classes/Ember
2017-07-23 19:16:15 +02:00
https://emberjs.com/api/ember-data/2.14/classes/DS
)
end
2013-10-24 20:25:52 +02:00
end
end