History

Add Cordova documentation

Thibaut committed 12 years ago

Commit 405e2631 parent 63715a313 files · +99 −-2Browse 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/stylesheets/application.css.scss +1 −0
  6. assets/stylesheets/global/_icons.scss +2 −1
  7. assets/stylesheets/pages/_cordova.scss +10 −0
  8. lib/docs/filters/cordova/clean_html.rb +34 −0
  9. lib/docs/filters/cordova/entries.rb +25 −0
  10. lib/docs/scrapers/cordova.rb +21 −0
  11. public/icons/docs/cordova/16.png +0 −0
  12. public/icons/docs/cordova/16@2x.png +0 −0
  13. public/icons/docs/cordova/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
@@ -100,6 +100,11 @@ credits = [ · 99 unmodified lines
100 '2009-2014 Jeremy Ashkenas',100 '2009-2014 Jeremy Ashkenas',
101 'MIT',101 'MIT',
102 'https://raw.github.com/jashkenas/coffee-script/master/LICENSE'102 'https://raw.github.com/jashkenas/coffee-script/master/LICENSE'
103 ], [
104 'Cordova',
105 '2012 The Apache Software Foundation',
106 'Apache',
107 'https://raw.githubusercontent.com/apache/cordova-docs/master/LICENSE'
103 ], [108 ], [
104 'CSS<br>DOM<br>HTML<br>JavaScript',109 'CSS<br>DOM<br>HTML<br>JavaScript',
105 '2005-2013 Mozilla Developer Network and individual contributors',110 '2005-2013 Mozilla Developer Network and individual contributors',
assets/javascripts/templates/pages/news_tmpl.coffee+4−1
@@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines
24 result24 result
25 25
26app.news = [26app.news = [
27 [ 1404172800000, # July 1, 201427 [ 1404518400000, # July 5, 2014
28 """ New <a href="/cordova/">Cordova</a> documentation """,
29 ], [
30 1404172800000, # July 1, 2014
28 """ New <a href="/chai/">Chai</a> and <a href="/sinon/">Sinon</a> documentations """,31 """ New <a href="/chai/">Chai</a> and <a href="/sinon/">Sinon</a> documentations """,
29 ], [32 ], [
30 1402790400000, # June 15, 201433 1402790400000, # June 15, 2014
assets/stylesheets/application.css.scss+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
32 'pages/c',32 'pages/c',
33 'pages/chai',33 'pages/chai',
34 'pages/coffeescript',34 'pages/coffeescript',
35 'pages/cordova',
35 'pages/d3',36 'pages/d3',
36 'pages/ember',37 'pages/ember',
37 'pages/express',38 'pages/express',
assets/stylesheets/global/_icons.scss+2−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
4 width: 1rem;4 width: 1rem;
5 height: 1rem;5 height: 1rem;
6 background-image: image-url('icons.png');6 background-image: image-url('icons.png');
7 background-size: 5rem 10rem;7 background-size: 5rem 11rem;
8}8}
9 9
10@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {10@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
@@ -61,3 +61,4 @@ · 50 unmodified lines
61._icon-requirejs:before { background-position: -2rem -9rem; }61._icon-requirejs:before { background-position: -2rem -9rem; }
62._icon-chai:before { background-position: -3rem -9rem; }62._icon-chai:before { background-position: -3rem -9rem; }
63._icon-sinon:before { background-position: -4rem -9rem; }63._icon-sinon:before { background-position: -4rem -9rem; }
64._icon-cordova:before { background-position: 0 -10rem; }
assets/stylesheets/pages/_cordova.scss+10−0
@@ -0,0 +1,10 @@
1._cordova {
2 padding-left: 1rem;
3
4 > h1, > h2 { margin-left: -1rem; }
5 > h2 { @extend %block-heading; }
6 > h3 { font-size: 1rem; }
7
8 code { @extend %label; }
9 blockquote { @extend %note; }
10}
lib/docs/filters/cordova/clean_html.rb+34−0
@@ -0,0 +1,34 @@
1module Docs
2 class Cordova
3 class CleanHtmlFilter < Filter
4 def call
5 if root_page? || slug == 'cordova_events_events.md'
6 css('h1, h2').each do |node|
7 node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
8 end
9 at_css('h2').name = 'h1' if slug == 'cordova_events_events.md'
10 end
11
12 if root_page?
13 css('li > h3').each do |node|
14 node.name = 'div'
15 end
16 end
17
18 css('hr').remove
19
20 css('a[name]').each do |node|
21 node.parent['id'] = node['name']
22 node.before(node.children).remove
23 end
24
25 # Remove code highlighting
26 css('pre').each do |node|
27 node.content = node.content.remove(/^\ {4,5}/)
28 end
29
30 doc
31 end
32 end
33 end
34end
lib/docs/filters/cordova/entries.rb+25−0
@@ -0,0 +1,25 @@
1module Docs
2 class Cordova
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 at_css('h1').content.remove(' Guide')
6 end
7
8 def get_type
9 if subpath.start_with?('guide_platforms')
10 name[/Amazon\ Fire\ OS|Android|BlackBerry|Firefox OS|iOS|Windows/] || 'Platform Guides'
11 else
12 'Guides'
13 end
14 end
15
16 def additional_entries
17 return [] unless slug == 'cordova_events_events.md'
18
19 css('h2').map do |node|
20 [node.content, node['id'], 'Events']
21 end
22 end
23 end
24 end
25end
lib/docs/scrapers/cordova.rb+21−0
@@ -0,0 +1,21 @@
1module Docs
2 class Cordova < UrlScraper
3 self.name = 'Cordova'
4 self.type = 'cordova'
5 self.version = '3.5.0'
6 self.base_url = 'http://cordova.apache.org/docs/en/3.5.0/'
7 self.root_path = 'index.html'
8
9 html_filters.push 'cordova/clean_html', 'cordova/entries', 'title'
10
11 options[:container] = ->(filter) { filter.root_page? ? '#home' : '#content' }
12 options[:title] = false
13 options[:root_title] = 'Apache Cordova'
14 options[:skip] = %w(_index.html guide_support_index.md.html)
15
16 options[:attribution] = <<-HTML
17 &copy; 2012 The Apache Software Foundation<br>
18 Licensed under the Apache License 2.0.
19 HTML
20 end
21end
public/icons/docs/cordova/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/cordova/SOURCE+1−0
@@ -0,0 +1 @@
1http://cordova.apache.org/artwork.html