diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 7157e594..11f195e5 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -132,7 +132,7 @@ credits = [ 'https://raw.github.com/emberjs/ember.js/master/LICENSE' ], [ 'Express', - '2009-2014 TJ Holowaychuk', + '2009-2015 TJ Holowaychuk', 'MIT', 'https://raw.githubusercontent.com/visionmedia/express/master/LICENSE' ], [ diff --git a/assets/stylesheets/pages/_express.scss b/assets/stylesheets/pages/_express.scss index 9b388a9d..9115a55f 100644 --- a/assets/stylesheets/pages/_express.scss +++ b/assets/stylesheets/pages/_express.scss @@ -5,4 +5,6 @@ h2 { @extend %block-heading; } h3 { @extend %block-label, %label-blue; } p > code { @extend %label; } + .doc-box { @extend %note; } + .doc-warn { @extend %note-red; } } diff --git a/lib/docs/filters/express/clean_html.rb b/lib/docs/filters/express/clean_html.rb index 2f21922c..2d99be8d 100644 --- a/lib/docs/filters/express/clean_html.rb +++ b/lib/docs/filters/express/clean_html.rb @@ -2,12 +2,14 @@ module Docs class Express class CleanHtmlFilter < Filter def call - at_css('h1').remove - css('section').each do |node| node.before(node.children).remove end + doc.child.remove while doc.child.name != 'h1' + + at_css('h1').remove if root_page? + # Put id attributes on headings css('h2 + a[name]').each do |node| node.previous_element['id'] = node['name'] diff --git a/lib/docs/filters/express/entries.rb b/lib/docs/filters/express/entries.rb index bd3330ee..667829d8 100644 --- a/lib/docs/filters/express/entries.rb +++ b/lib/docs/filters/express/entries.rb @@ -1,7 +1,22 @@ module Docs class Express class EntriesFilter < Docs::EntriesFilter + TYPES_BY_PATH = { + 'starter' => 'Getting started', + 'guide' => 'Guide', + 'advanced' => 'Guide' + } + + def get_name + at_css('h1').content + end + + def get_type + TYPES_BY_PATH[slug.split('/').first] + end + def additional_entries + return [] unless root_page? type = 'Application' doc.children.each_with_object [] do |node, entries| diff --git a/lib/docs/scrapers/express.rb b/lib/docs/scrapers/express.rb index bfb7621c..b57948a1 100644 --- a/lib/docs/scrapers/express.rb +++ b/lib/docs/scrapers/express.rb @@ -2,17 +2,24 @@ module Docs class Express < UrlScraper self.name = 'Express' self.type = 'express' - self.version = '4.10.0' - self.base_url = 'http://expressjs.com/4x/api.html' + self.version = '4.11.1' + self.base_url = 'http://expressjs.com/' + self.root_path = '4x/api.html' html_filters.push 'express/clean_html', 'express/entries', 'title' - options[:title] = 'Express' - options[:container] = '#api-doc' - options[:skip_links] = true + options[:title] = false + options[:root_title] = 'Express' + options[:container] = ->(filter) { filter.root_page? ? '#api-doc' : '.content' } + + options[:only_patterns] = [ + /\Astarter/, + /\Aguide/, + /\Aadvanced/ + ] options[:attribution] = <<-HTML - © 2009–2014 TJ Holowaychuk
+ © 2009–2015 TJ Holowaychuk
Licensed under the MIT License. HTML end