History

Add Marionette.js documentation

Thibaut committed 12 years ago

Commit cc509c11 parent 5335c8114 files · +85 −-3Browse 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 +1 −1
  5. assets/javascripts/views/pages/marionette.coffee +4 −0
  6. assets/stylesheets/application.css.scss +1 −0
  7. assets/stylesheets/global/_icons.scss +1 −0
  8. assets/stylesheets/pages/_marionette.scss +7 −0
  9. lib/docs/filters/marionette/clean_html.rb +30 −0
  10. lib/docs/filters/marionette/entries.rb +12 −0
  11. lib/docs/scrapers/marionette.rb +27 −0
  12. public/icons/docs/marionette/16.png +0 −0
  13. public/icons/docs/marionette/16@2x.png +0 −0
  14. public/icons/docs/marionette/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
@@ -192,6 +192,11 @@ credits = [ · 191 unmodified lines
192192 '2009-2014 The Dojo Foundation',
193193 'MIT',
194194 'https://raw.github.com/lodash/lodash/master/LICENSE.txt'
195+ ], [
196+ 'Marionette.js',
197+ '2014 Muted Solutions, LLC',
198+ 'MIT',
199+ 'http://mutedsolutions.mit-license.org/'
195200 ], [
196201 'Markdown',
197202 '2004 John Gruber',
assets/javascripts/templates/pages/news_tmpl.coffee+1−1
@@ -34,7 +34,7 @@ newsItem = (date, news) -> · 33 unmodified lines
3434
3535 app.news = [
3636 [ 1413676800000, # October 19, 2014
37− """ New <a href="/svg/">SVG</a> documentation """,
37+ """ New <a href="/svg/">SVG</a> and <a href="/marionette">Marionette.js</a> documentations """,
3838 ], [
3939 1413590400000, # October 18, 2014
4040 """ New <a href="/nginx/">nginx</a> documentation """,
assets/javascripts/views/pages/marionette.coffee+4−0
@@ -0,0 +1,4 @@
1+#= require views/pages/base
2+#= require views/pages/underscore
3+
4+app.views.MarionettePage = app.views.UnderscorePage
assets/stylesheets/application.css.scss+1−0
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 'pages/laravel',
4646 'pages/less',
4747 'pages/lodash',
48+ 'pages/marionette',
4849 'pages/markdown',
4950 'pages/maxcdn',
5051 'pages/mdn',
assets/stylesheets/global/_icons.scss+1−0
@@ -67,3 +67,4 @@ · 66 unmodified lines
6767 ._icon-xpath:before { background-position: -3rem -10rem; }
6868 ._icon-nginx:before { background-position: -4rem -10rem; }
6969 ._icon-svg:before { background-position: 0 -11rem; }
70+._icon-marionette:before { background-position: -1rem -11rem; }
assets/stylesheets/pages/_marionette.scss+7−0
@@ -0,0 +1,7 @@
1+._marionette {
2+ padding-left: 1rem;
3+
4+ > h1, > h2 { margin-left: -1rem; }
5+ > h2 { @extend %block-heading; }
6+ > h3 { @extend %block-label, %label-blue; }
7+}
lib/docs/filters/marionette/clean_html.rb+30−0
@@ -0,0 +1,30 @@
1+module Docs
2+ class Marionette
3+ class CleanHtmlFilter < Filter
4+ def call
5+ root_page? ? root : other
6+ doc
7+ end
8+
9+ def root
10+ at_css('p').remove
11+ end
12+
13+ def other
14+ css('#source + h2', '#improve', '#source', '.glyphicon').remove
15+
16+ css('pre > code').each do |node|
17+ node.before(node.children).remove
18+ end
19+
20+ css('h2', 'h3').each do |node|
21+ id = node.content.strip
22+ id.downcase!
23+ id.remove! %r{['"\/\.:]}
24+ id.gsub! %r{[\ _]}, '-'
25+ node['id'] = id
26+ end
27+ end
28+ end
29+ end
30+end
lib/docs/filters/marionette/entries.rb+12−0
@@ -0,0 +1,12 @@
1+module Docs
2+ class Marionette
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ name = at_css('h1').content.strip
6+ name.remove!(/Marionette./)
7+ name = name[0].upcase + name.from(1)
8+ name
9+ end
10+ end
11+ end
12+end
lib/docs/scrapers/marionette.rb+27−0
@@ -0,0 +1,27 @@
1+module Docs
2+ class Marionette < UrlScraper
3+ self.name = 'Marionette.js'
4+ self.slug = 'marionette'
5+ self.type = 'marionette'
6+ self.version = '2.2.1'
7+ self.base_url = 'http://marionettejs.com/docs/'
8+ self.root_path = 'current'
9+
10+ html_filters.push 'marionette/clean_html', 'marionette/entries'
11+
12+ options[:container] = '#content'
13+
14+ options[:skip] = %w(/readme.html)
15+ options[:skip_patterns] = [/\A\/v\d/]
16+
17+ options[:fix_urls] = ->(url) do
18+ url.sub! %r{marionette([^\/#\?]*)\.md}, 'marionette\1'
19+ url
20+ end
21+
22+ options[:attribution] = <<-HTML
23+ &copy; 2014 Muted Solutions, LLC<br>
24+ Licensed under the MIT License.
25+ HTML
26+ end
27+end
public/icons/docs/marionette/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/marionette/SOURCE+1−0
@@ -0,0 +1 @@
1+https://github.com/marionettejs/marionettejs.com