History

Add Express documentation

Thibaut committed 12 years ago

Commit 5f6f8a71 parent d2c210213 files · +83 −-3Browse files

Unified · Split

13 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  4. assets/javascripts/templates/pages/news_tmpl.coffee +4 −1
  5. assets/javascripts/views/pages/express.coffee +4 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +1 −0
  8. assets/stylesheets/pages/_express.scss +8 −0
  9. lib/docs/filters/express/clean_html.rb +24 −0
  10. lib/docs/filters/express/entries.rb +21 −0
  11. lib/docs/scrapers/express.rb +19 −0
  12. public/icons/docs/express/16.png +0 −0
  13. public/icons/docs/express/16@2x.png +0 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -110,6 +110,11 @@ credits = [ · 109 unmodified lines
110110 '2014 Yehuda Katz, Tom Dale and Ember.js contributors',
111111 'MIT',
112112 'https://raw.github.com/emberjs/ember.js/master/LICENSE'
113+ ], [
114+ 'Express',
115+ '2009-2014 TJ Holowaychuk',
116+ 'MIT',
117+ 'https://raw.githubusercontent.com/visionmedia/express/master/LICENSE'
113118 ], [
114119 'Git',
115120 '2005-2014 Linus Torvalds and others',
assets/javascripts/templates/pages/news_tmpl.coffee+4−1
@@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines
2424 result
2525
2626 app.news = [
27− [ 1396742400000, # April 6, 2014
27+ [ 1399075200000, # May 3, 2014
28+ """ New <a href="/express/">Express</a> documentation """,
29+ ], [
30+ 1396742400000, # April 6, 2014
2831 """ New <a href="/go/">Go</a> documentation """,
2932 ], [
3033 1396137600000, # March 30, 2014
assets/javascripts/views/pages/express.coffee+4−0
@@ -0,0 +1,4 @@
1+#= require views/pages/base
2+#= require views/pages/underscore
3+
4+app.views.ExpressPage = app.views.UnderscorePage
assets/stylesheets/application.css.scss+1−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 'pages/coffeescript',
3434 'pages/d3',
3535 'pages/ember',
36+ 'pages/express',
3637 'pages/go',
3738 'pages/jquery',
3839 'pages/knockout',
assets/stylesheets/global/_icons.scss+1−0
@@ -53,3 +53,4 @@ · 52 unmodified lines
5353 ._icon-yii:before { background-position: -4rem -7rem; }
5454 ._icon-cpp:before { background-position: 0 -8rem; }
5555 ._icon-go:before { background-position: -1rem -8rem; }
56+._icon-express:before { background-position: -2rem -8rem; }
assets/stylesheets/pages/_express.scss+8−0
@@ -0,0 +1,8 @@
1+._express {
2+ padding-left: 1rem;
3+
4+ h1, h2, h3 { margin-left: -1rem; }
5+ h2 { @extend %block-heading; }
6+ h3 { @extend %block-label, %label-blue; }
7+ p > code { @extend %label; }
8+}
lib/docs/filters/express/clean_html.rb+24−0
@@ -0,0 +1,24 @@
1+module Docs
2+ class Express
3+ class CleanHtmlFilter < Filter
4+ def call
5+ css('section').each do |node|
6+ node.before(node.children).remove
7+ end
8+
9+ # Put id attributes on headings
10+ css('h2 + a[name]').each do |node|
11+ node.previous_element['id'] = node['name']
12+ node.remove
13+ end
14+
15+ # Remove code highlighting
16+ css('pre').each do |node|
17+ node.content = node.content
18+ end
19+
20+ doc
21+ end
22+ end
23+ end
24+end
lib/docs/filters/express/entries.rb+21−0
@@ -0,0 +1,21 @@
1+module Docs
2+ class Express
3+ class EntriesFilter < Docs::EntriesFilter
4+ def additional_entries
5+ type = 'Application'
6+
7+ doc.children.each_with_object [] do |node, entries|
8+ if node.name == 'h2'
9+ type = node.content
10+ next
11+ elsif node.name == 'h3'
12+ name = node.content.strip
13+ name.sub! %r{\(.+\)}, '()'
14+
15+ entries << [name, node['id'], type]
16+ end
17+ end
18+ end
19+ end
20+ end
21+end
lib/docs/scrapers/express.rb+19−0
@@ -0,0 +1,19 @@
1+module Docs
2+ class Express < UrlScraper
3+ self.name = 'Express'
4+ self.type = 'express'
5+ self.version = '4.1.1'
6+ self.base_url = 'http://expressjs.com/4x/api.html'
7+
8+ html_filters.push 'express/clean_html', 'express/entries', 'title'
9+
10+ options[:title] = 'Express'
11+ options[:container] = '#right'
12+ options[:skip_links] = true
13+
14+ options[:attribution] = <<-HTML
15+ &copy; 2009&ndash;2014 TJ Holowaychuk<br>
16+ Licensed under the MIT License.
17+ HTML
18+ end
19+end
public/icons/docs/express/16.png+0−0

Binary file not shown.

public/icons/docs/express/16@2x.png+0−0

Binary file not shown.