diff --git a/assets/stylesheets/pages/_angular.scss b/assets/stylesheets/pages/_angular.scss index 846fc436..84fb16ea 100644 --- a/assets/stylesheets/pages/_angular.scss +++ b/assets/stylesheets/pages/_angular.scss @@ -19,4 +19,6 @@ font-style: italic; text-align: right; } + + td h3 { margin: 0 !important; } } diff --git a/lib/docs/filters/angular/clean_html.rb b/lib/docs/filters/angular/clean_html.rb index 59957865..75112710 100644 --- a/lib/docs/filters/angular/clean_html.rb +++ b/lib/docs/filters/angular/clean_html.rb @@ -7,7 +7,7 @@ module Docs at_css('h1').content = 'Angular Documentation' end - css('br', 'hr', '.material-icons', '.header-link').remove + css('br', 'hr', '.material-icons', '.header-link', '.breadcrumb').remove css('.content', 'article', '.api-header', 'section', '.instance-member').each do |node| node.before(node.children).remove @@ -86,6 +86,14 @@ module Docs at_css('h1').content = subpath.remove('api/') end + css('th h3').each do |node| + node.name = 'span' + end + + css('code code').each do |node| + node.before(node.children).remove + end + doc end end diff --git a/lib/docs/filters/angular/entries.rb b/lib/docs/filters/angular/entries.rb index 4b571063..da0a9d4b 100644 --- a/lib/docs/filters/angular/entries.rb +++ b/lib/docs/filters/angular/entries.rb @@ -16,6 +16,8 @@ module Docs node.next_element.content.remove('@angular/') elsif at_css('.api-type-label.module') name.split('/').first + elsif slug.start_with?('api/') + slug.split('/').second else 'Miscellaneous' end diff --git a/lib/docs/scrapers/angular.rb b/lib/docs/scrapers/angular.rb index 18770c7e..c318ce25 100644 --- a/lib/docs/scrapers/angular.rb +++ b/lib/docs/scrapers/angular.rb @@ -59,7 +59,7 @@ module Docs end version do - self.release = '5.2.9' + self.release = '6.0.4' self.base_url = 'https://angular.io/' self.root_path = 'docs' @@ -78,6 +78,26 @@ module Docs include Docs::Angular::Common end + version '5' do + self.release = '5.2.11' + self.base_url = 'https://v5.angular.io/' + self.root_path = 'docs' + + html_filters.push 'angular/clean_html', 'angular/entries' + + options[:follow_links] = false + options[:only_patterns] = [/\Aguide/, /\Atutorial/, /\Aapi/] + options[:fix_urls_before_parse] = ->(url) do + url.sub! %r{\Aguide/}, '/guide/' + url.sub! %r{\Atutorial/}, '/tutorial/' + url.sub! %r{\Aapi/}, '/api/' + url.sub! %r{\Agenerated/}, '/generated/' + url + end + + include Docs::Angular::Common + end + version '4' do self.release = '4.4.6' self.base_url = 'https://v4.angular.io/'