mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
module Docs
|
|
class Angular < UrlScraper
|
|
include StubRootPage
|
|
|
|
self.name = 'Angular.js'
|
|
self.slug = 'angular'
|
|
self.type = 'angular'
|
|
self.version = '1.4.3'
|
|
self.base_url = "https://code.angularjs.org/#{version}/docs/partials/api/"
|
|
|
|
html_filters.push 'angular/clean_html', 'angular/entries', 'title'
|
|
text_filters.push 'angular/clean_urls'
|
|
|
|
options[:title] = false
|
|
options[:root_title] = 'Angular.js'
|
|
|
|
options[:fix_urls] = ->(url) do
|
|
url.sub! '/partials/api/api/', '/partials/api/'
|
|
url.sub! %r{/api/(.+?)/api/}, '/api/'
|
|
url.sub! %r{/partials/api/(.+?)(?<!\.html)(?:\z|(#.*))}, '/partials/api/\1.html\2'
|
|
url
|
|
end
|
|
|
|
options[:skip] = %w(ng.html)
|
|
|
|
options[:attribution] = <<-HTML
|
|
© 2010–2015 Google, Inc.<br>
|
|
Licensed under the Creative Commons Attribution License 3.0.
|
|
HTML
|
|
|
|
private
|
|
|
|
def root_page_body
|
|
require 'capybara'
|
|
Capybara.current_driver = :selenium
|
|
Capybara.visit("https://code.angularjs.org/#{self.class.version}/docs/api")
|
|
Capybara.find('.side-navigation')['innerHTML']
|
|
end
|
|
end
|
|
end
|