1
0
Эх сурвалжийг харах

Add Marionette.js documentation

Thibaut 11 жил өмнө
parent
commit
cc509c17f2

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -192,6 +192,11 @@ credits = [
     '2009-2014 The Dojo Foundation',
     'MIT',
     'https://raw.github.com/lodash/lodash/master/LICENSE.txt'
+  ], [
+    'Marionette.js',
+    '2014 Muted Solutions, LLC',
+    'MIT',
+    'http://mutedsolutions.mit-license.org/'
   ], [
     'Markdown',
     '2004 John Gruber',

+ 1 - 1
assets/javascripts/templates/pages/news_tmpl.coffee

@@ -34,7 +34,7 @@ newsItem = (date, news) ->
 
 app.news = [
   [ 1413676800000, # October 19, 2014
-    """ New <a href="/svg/">SVG</a> documentation """,
+    """ New <a href="/svg/">SVG</a> and <a href="/marionette">Marionette.js</a> documentations """,
   ], [
     1413590400000, # October 18, 2014
     """ New <a href="/nginx/">nginx</a> documentation """,

+ 4 - 0
assets/javascripts/views/pages/marionette.coffee

@@ -0,0 +1,4 @@
+#= require views/pages/base
+#= require views/pages/underscore
+
+app.views.MarionettePage = app.views.UnderscorePage

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -45,6 +45,7 @@
         'pages/laravel',
         'pages/less',
         'pages/lodash',
+        'pages/marionette',
         'pages/markdown',
         'pages/maxcdn',
         'pages/mdn',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -67,3 +67,4 @@
 ._icon-xpath:before         { background-position: -3rem -10rem; }
 ._icon-nginx:before         { background-position: -4rem -10rem; }
 ._icon-svg:before           { background-position: 0 -11rem; }
+._icon-marionette:before    { background-position: -1rem -11rem; }

+ 7 - 0
assets/stylesheets/pages/_marionette.scss

@@ -0,0 +1,7 @@
+._marionette {
+  padding-left: 1rem;
+
+  > h1, > h2 { margin-left: -1rem; }
+  > h2 { @extend %block-heading; }
+  > h3 { @extend %block-label, %label-blue; }
+}

+ 30 - 0
lib/docs/filters/marionette/clean_html.rb

@@ -0,0 +1,30 @@
+module Docs
+  class Marionette
+    class CleanHtmlFilter < Filter
+      def call
+        root_page? ? root : other
+        doc
+      end
+
+      def root
+        at_css('p').remove
+      end
+
+      def other
+        css('#source + h2', '#improve', '#source', '.glyphicon').remove
+
+        css('pre > code').each do |node|
+          node.before(node.children).remove
+        end
+
+        css('h2', 'h3').each do |node|
+          id = node.content.strip
+          id.downcase!
+          id.remove! %r{['"\/\.:]}
+          id.gsub! %r{[\ _]}, '-'
+          node['id'] = id
+        end
+      end
+    end
+  end
+end

+ 12 - 0
lib/docs/filters/marionette/entries.rb

@@ -0,0 +1,12 @@
+module Docs
+  class Marionette
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        name = at_css('h1').content.strip
+        name.remove!(/Marionette./)
+        name = name[0].upcase + name.from(1)
+        name
+      end
+    end
+  end
+end

+ 27 - 0
lib/docs/scrapers/marionette.rb

@@ -0,0 +1,27 @@
+module Docs
+  class Marionette < UrlScraper
+    self.name = 'Marionette.js'
+    self.slug = 'marionette'
+    self.type = 'marionette'
+    self.version = '2.2.1'
+    self.base_url = 'http://marionettejs.com/docs/'
+    self.root_path = 'current'
+
+    html_filters.push 'marionette/clean_html', 'marionette/entries'
+
+    options[:container] = '#content'
+
+    options[:skip] = %w(/readme.html)
+    options[:skip_patterns] = [/\A\/v\d/]
+
+    options[:fix_urls] = ->(url) do
+      url.sub! %r{marionette([^\/#\?]*)\.md}, 'marionette\1'
+      url
+    end
+
+    options[:attribution] = <<-HTML
+      &copy; 2014 Muted Solutions, LLC<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

BIN
public/icons/docs/marionette/16.png


BIN
public/icons/docs/marionette/16@2x.png


+ 1 - 0
public/icons/docs/marionette/SOURCE

@@ -0,0 +1 @@
+https://github.com/marionettejs/marionettejs.com