Add Express documentation

pull/90/head
Thibaut 11 years ago
parent d2c210286a
commit 5f6f8a7194

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

@ -110,6 +110,11 @@ credits = [
'2014 Yehuda Katz, Tom Dale and Ember.js contributors',
'MIT',
'https://raw.github.com/emberjs/ember.js/master/LICENSE'
], [
'Express',
'2009-2014 TJ Holowaychuk',
'MIT',
'https://raw.githubusercontent.com/visionmedia/express/master/LICENSE'
], [
'Git',
'2005-2014 Linus Torvalds and others',

@ -24,7 +24,10 @@ newsItem = (date, news) ->
result
app.news = [
[ 1396742400000, # April 6, 2014
[ 1399075200000, # May 3, 2014
""" New <a href="/express/">Express</a> documentation """,
], [
1396742400000, # April 6, 2014
""" New <a href="/go/">Go</a> documentation """,
], [
1396137600000, # March 30, 2014

@ -0,0 +1,4 @@
#= require views/pages/base
#= require views/pages/underscore
app.views.ExpressPage = app.views.UnderscorePage

@ -33,6 +33,7 @@
'pages/coffeescript',
'pages/d3',
'pages/ember',
'pages/express',
'pages/go',
'pages/jquery',
'pages/knockout',

@ -53,3 +53,4 @@
._icon-yii:before { background-position: -4rem -7rem; }
._icon-cpp:before { background-position: 0 -8rem; }
._icon-go:before { background-position: -1rem -8rem; }
._icon-express:before { background-position: -2rem -8rem; }

@ -0,0 +1,8 @@
._express {
padding-left: 1rem;
h1, h2, h3 { margin-left: -1rem; }
h2 { @extend %block-heading; }
h3 { @extend %block-label, %label-blue; }
p > code { @extend %label; }
}

@ -0,0 +1,24 @@
module Docs
class Express
class CleanHtmlFilter < Filter
def call
css('section').each do |node|
node.before(node.children).remove
end
# Put id attributes on headings
css('h2 + a[name]').each do |node|
node.previous_element['id'] = node['name']
node.remove
end
# Remove code highlighting
css('pre').each do |node|
node.content = node.content
end
doc
end
end
end
end

@ -0,0 +1,21 @@
module Docs
class Express
class EntriesFilter < Docs::EntriesFilter
def additional_entries
type = 'Application'
doc.children.each_with_object [] do |node, entries|
if node.name == 'h2'
type = node.content
next
elsif node.name == 'h3'
name = node.content.strip
name.sub! %r{\(.+\)}, '()'
entries << [name, node['id'], type]
end
end
end
end
end
end

@ -0,0 +1,19 @@
module Docs
class Express < UrlScraper
self.name = 'Express'
self.type = 'express'
self.version = '4.1.1'
self.base_url = 'http://expressjs.com/4x/api.html'
html_filters.push 'express/clean_html', 'express/entries', 'title'
options[:title] = 'Express'
options[:container] = '#right'
options[:skip_links] = true
options[:attribution] = <<-HTML
&copy; 2009&ndash;2014 TJ Holowaychuk<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Loading…
Cancel
Save