Add MaxCDN documentation

pull/90/head
Thibaut 11 years ago
parent 50dfc91721
commit 013eff4cba

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 47 KiB

@ -165,6 +165,11 @@ credits = [
'2009-2013 The Dojo Foundation',
'MIT',
'https://raw.github.com/lodash/lodash/master/LICENSE.txt'
], [
'MaxCDN',
'2014 MaxCDN',
'MIT',
'https://raw.githubusercontent.com/MaxCDN/api-docs/master/LICENSE'
], [
'Moment.js',
'2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors',

@ -24,8 +24,8 @@ newsItem = (date, news) ->
result
app.news = [
[ 1399075200000, # May 3, 2014
""" New <a href="/express/">Express</a> and <a href="/grunt/">Grunt</a> documentations """,
[ 1399161600000, # May 4, 2014
""" New <a href="/express/">Express</a>, <a href="/grunt/">Grunt</a>, and <a href="/maxcdn/">MaxCDN</a> documentations """,
], [
1396742400000, # April 6, 2014
""" New <a href="/go/">Go</a> documentation """,

@ -0,0 +1,28 @@
#= require views/pages/base
class app.views.MaxcdnPage extends app.views.BasePage
@events:
click: 'onClick'
afterRender: ->
@highlightCode @findAll('.tab-pane[id^="ruby"] > pre'), 'ruby'
@highlightCode @findAll('.tab-pane[id^="python"] > pre'), 'python'
@highlightCode @findAll('.tab-pane[id^="node"] > pre, .tab-pane[id^="resp"] > pre'), 'javascript'
return
onClick: (event) ->
return unless (link = event.target).getAttribute('data-toggle') is 'tab'
$.stopEvent(event)
list = link.parentNode.parentNode
tabs = list.nextElementSibling
li = link.parentNode
position = 1
position++ while li = li.previousElementSibling
$('.active', list).classList.remove('active')
$('.active', tabs).classList.remove('active')
link.parentNode.classList.add('active')
$(".tab-pane:nth-child(#{position})", tabs).classList.add('active')

@ -41,6 +41,7 @@
'pages/grunt',
'pages/less',
'pages/lodash',
'pages/maxcdn',
'pages/mdn',
'pages/moment',
'pages/node',

@ -55,3 +55,4 @@
._icon-go:before { background-position: -1rem -8rem; }
._icon-express:before { background-position: -2rem -8rem; }
._icon-grunt:before { background-position: -3rem -8rem; }
._icon-maxcdn:before { background-position: -4rem -8rem; }

@ -0,0 +1,49 @@
._maxcdn {
padding-left: 1rem;
h1, h2, h3 { margin-left: -1rem; }
h2 { @extend %block-heading; }
h3 { @extend %block-label, %label-blue; }
h4 { font-size: 1em; }
p > code { @extend %label; }
.url {
padding: .5rem;
white-space: normal;
@extend %pre, %note-green;
}
.http_method { @extend %label; }
.nav-tabs {
height: 2rem;
padding: 0;
list-style: none;
border-bottom: 1px solid #ddd;
> li {
float: left;
margin: -1px 0;
> a {
display: block;
padding: .5rem 1em;
line-height: 1rem;
margin-right: 2px;
border: 1px solid transparent;
border-radius: 3px 3px 0 0;
}
&.active > a {
color: $textColor;
text-decoration: none;
background: white;
border-color: #ddd #ddd transparent;
cursor: default;
}
}
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }
}

@ -0,0 +1,25 @@
module Docs
class Maxcdn
class CleanHtmlFilter < Filter
def call
css('hr', 'td:last-child:empty').remove
css('h1, h2, h3, h4').each do |node|
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
end
at_css('h2').name = 'h1'
css('.path > a').each do |node|
node.before(node.children).remove
end
css('[name]').each do |node|
node.remove_attribute 'name'
end
doc
end
end
end
end

@ -0,0 +1,30 @@
module Docs
class Maxcdn
class EntriesFilter < Docs::EntriesFilter
def additional_entries
type = id_prefix = nil
doc.children.each_with_object [] do |node, entries|
if node.name == 'h2'
type = node.content.strip
type.remove! %r{ API\z}
type.remove! ' Custom Domains'
id_prefix = type.parameterize
type = 'Reports' if type.starts_with? 'Reports'
elsif node.name == 'h3'
next unless type
name = node.content.strip
id = "#{id_prefix}-#{name}".parameterize
node['id'] = id
if name.ends_with?('Domain') && ['Push Zone', 'Pull Zone', 'VOD Zone'].include?(type)
name << " (#{type})"
end
entries << [name, id, type]
end
end
end
end
end
end

@ -0,0 +1,17 @@
module Docs
class Maxcdn < UrlScraper
self.name = 'MaxCDN'
self.type = 'maxcdn'
self.base_url = 'http://docs.maxcdn.com/'
html_filters.push 'maxcdn/clean_html', 'maxcdn/entries'
options[:container] = '#readme-docs'
options[:skip_links] = true
options[:attribution] = <<-HTML
&copy; 2014 MaxCDN<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1 @@
https://github.com/MaxCDN/media
Loading…
Cancel
Save