History

Add MaxCDN documentation

Thibaut committed 12 years ago

Commit 013eff41 parent 50dfc9114 files · +155 −-2Browse files

Unified · Split

14 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 +2 −2
  5. assets/javascripts/views/pages/maxcdn.coffee +28 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +1 −0
  8. assets/stylesheets/pages/_maxcdn.scss +49 −0
  9. lib/docs/filters/maxcdn/clean_html.rb +25 −0
  10. lib/docs/filters/maxcdn/entries.rb +30 −0
  11. lib/docs/scrapers/maxcdn.rb +17 −0
  12. public/icons/docs/maxcdn/16.png +0 −0
  13. public/icons/docs/maxcdn/16@2x.png +0 −0
  14. public/icons/docs/maxcdn/SOURCE +1 −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
@@ -165,6 +165,11 @@ credits = [ · 164 unmodified lines
165 '2009-2013 The Dojo Foundation',165 '2009-2013 The Dojo Foundation',
166 'MIT',166 'MIT',
167 'https://raw.github.com/lodash/lodash/master/LICENSE.txt'167 'https://raw.github.com/lodash/lodash/master/LICENSE.txt'
168 ], [
169 'MaxCDN',
170 '2014 MaxCDN',
171 'MIT',
172 'https://raw.githubusercontent.com/MaxCDN/api-docs/master/LICENSE'
168 ], [173 ], [
169 'Moment.js',174 'Moment.js',
170 '2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',175 '2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',
assets/javascripts/templates/pages/news_tmpl.coffee+2−2
@@ -24,8 +24,8 @@ newsItem = (date, news) -> · 23 unmodified lines
24 result24 result
25 25
26app.news = [26app.news = [
27 [ 1399075200000, # May 3, 201427 [ 1399161600000, # May 4, 2014
28 """ New <a href="/express/">Express</a> and <a href="/grunt/">Grunt</a> documentations """,28 """ New <a href="/express/">Express</a>, <a href="/grunt/">Grunt</a>, and <a href="/maxcdn/">MaxCDN</a> documentations """,
29 ], [29 ], [
30 1396742400000, # April 6, 201430 1396742400000, # April 6, 2014
31 """ New <a href="/go/">Go</a> documentation """,31 """ New <a href="/go/">Go</a> documentation """,
assets/javascripts/views/pages/maxcdn.coffee+28−0
@@ -0,0 +1,28 @@
1#= require views/pages/base
2
3class app.views.MaxcdnPage extends app.views.BasePage
4 @events:
5 click: 'onClick'
6
7 afterRender: ->
8 @highlightCode @findAll('.tab-pane[id^="ruby"] > pre'), 'ruby'
9 @highlightCode @findAll('.tab-pane[id^="python"] > pre'), 'python'
10 @highlightCode @findAll('.tab-pane[id^="node"] > pre, .tab-pane[id^="resp"] > pre'), 'javascript'
11 return
12
13 onClick: (event) ->
14 return unless (link = event.target).getAttribute('data-toggle') is 'tab'
15 $.stopEvent(event)
16
17 list = link.parentNode.parentNode
18 tabs = list.nextElementSibling
19
20 li = link.parentNode
21 position = 1
22 position++ while li = li.previousElementSibling
23
24 $('.active', list).classList.remove('active')
25 $('.active', tabs).classList.remove('active')
26
27 link.parentNode.classList.add('active')
28 $(".tab-pane:nth-child(#{position})", tabs).classList.add('active')
assets/stylesheets/application.css.scss+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
41 'pages/grunt',41 'pages/grunt',
42 'pages/less',42 'pages/less',
43 'pages/lodash',43 'pages/lodash',
44 'pages/maxcdn',
44 'pages/mdn',45 'pages/mdn',
45 'pages/moment',46 'pages/moment',
46 'pages/node',47 'pages/node',
assets/stylesheets/global/_icons.scss+1−0
@@ -55,3 +55,4 @@ · 54 unmodified lines
55._icon-go:before { background-position: -1rem -8rem; }55._icon-go:before { background-position: -1rem -8rem; }
56._icon-express:before { background-position: -2rem -8rem; }56._icon-express:before { background-position: -2rem -8rem; }
57._icon-grunt:before { background-position: -3rem -8rem; }57._icon-grunt:before { background-position: -3rem -8rem; }
58._icon-maxcdn:before { background-position: -4rem -8rem; }
assets/stylesheets/pages/_maxcdn.scss+49−0
@@ -0,0 +1,49 @@
1._maxcdn {
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 h4 { font-size: 1em; }
8 p > code { @extend %label; }
9
10 .url {
11 padding: .5rem;
12 white-space: normal;
13 @extend %pre, %note-green;
14 }
15
16 .http_method { @extend %label; }
17
18 .nav-tabs {
19 height: 2rem;
20 padding: 0;
21 list-style: none;
22 border-bottom: 1px solid #ddd;
23
24 > li {
25 float: left;
26 margin: -1px 0;
27
28 > a {
29 display: block;
30 padding: .5rem 1em;
31 line-height: 1rem;
32 margin-right: 2px;
33 border: 1px solid transparent;
34 border-radius: 3px 3px 0 0;
35 }
36
37 &.active > a {
38 color: $textColor;
39 text-decoration: none;
40 background: white;
41 border-color: #ddd #ddd transparent;
42 cursor: default;
43 }
44 }
45 }
46
47 .tab-pane { display: none; }
48 .tab-pane.active { display: block; }
49}
lib/docs/filters/maxcdn/clean_html.rb+25−0
@@ -0,0 +1,25 @@
1module Docs
2 class Maxcdn
3 class CleanHtmlFilter < Filter
4 def call
5 css('hr', 'td:last-child:empty').remove
6
7 css('h1, h2, h3, h4').each do |node|
8 node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
9 end
10
11 at_css('h2').name = 'h1'
12
13 css('.path > a').each do |node|
14 node.before(node.children).remove
15 end
16
17 css('[name]').each do |node|
18 node.remove_attribute 'name'
19 end
20
21 doc
22 end
23 end
24 end
25end
lib/docs/filters/maxcdn/entries.rb+30−0
@@ -0,0 +1,30 @@
1module Docs
2 class Maxcdn
3 class EntriesFilter < Docs::EntriesFilter
4 def additional_entries
5 type = id_prefix = nil
6
7 doc.children.each_with_object [] do |node, entries|
8 if node.name == 'h2'
9 type = node.content.strip
10 type.remove! %r{ API\z}
11 type.remove! ' Custom Domains'
12 id_prefix = type.parameterize
13 type = 'Reports' if type.starts_with? 'Reports'
14 elsif node.name == 'h3'
15 next unless type
16 name = node.content.strip
17 id = "#{id_prefix}-#{name}".parameterize
18 node['id'] = id
19
20 if name.ends_with?('Domain') && ['Push Zone', 'Pull Zone', 'VOD Zone'].include?(type)
21 name << " (#{type})"
22 end
23
24 entries << [name, id, type]
25 end
26 end
27 end
28 end
29 end
30end
lib/docs/scrapers/maxcdn.rb+17−0
@@ -0,0 +1,17 @@
1module Docs
2 class Maxcdn < UrlScraper
3 self.name = 'MaxCDN'
4 self.type = 'maxcdn'
5 self.base_url = 'http://docs.maxcdn.com/'
6
7 html_filters.push 'maxcdn/clean_html', 'maxcdn/entries'
8
9 options[:container] = '#readme-docs'
10 options[:skip_links] = true
11
12 options[:attribution] = <<-HTML
13 &copy; 2014 MaxCDN<br>
14 Licensed under the MIT License.
15 HTML
16 end
17end
public/icons/docs/maxcdn/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/maxcdn/SOURCE+1−0
@@ -0,0 +1 @@
1https://github.com/MaxCDN/media