浏览代码

Merge pull request #1828 from thewheat/moment-timezone

Add Moment.js Timezone (0.5.37)
Simon Legner 3 年之前
父节点
当前提交
012332aeb1

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

@@ -577,7 +577,7 @@ credits = [
     'MIT',
     'https://modernizr.com/license/'
   ], [
-    'Moment.js',
+    'Moment.js<br>Moment.js Timezone',
     'JS Foundation and other contributors',
     'MIT',
     'https://raw.githubusercontent.com/moment/moment/master/LICENSE'

+ 21 - 0
lib/docs/filters/moment_timezone/entries.rb

@@ -0,0 +1,21 @@
+module Docs
+  class MomentTimezone
+    class EntriesFilter < Docs::EntriesFilter
+
+      def additional_entries
+        entries = []
+        type = nil
+
+        css('[id]').each do |node|
+          if node.name == 'h2'
+            type = node.content
+          end
+          name = node.content.strip
+          entries << [name, node['id'], type]
+        end
+
+        entries
+      end
+    end
+  end
+end

+ 30 - 0
lib/docs/scrapers/moment_timezone.rb

@@ -0,0 +1,30 @@
+module Docs
+  class MomentTimezone < UrlScraper
+    self.name = 'Moment.js Timezone'
+    self.slug = 'moment_timezone'
+    self.type = 'moment'
+    self.release = '0.5.37'
+    self.base_url = 'https://momentjs.com/timezone'
+    self.root_path = '/docs/'
+    self.initial_paths = %w(/docs/)
+    self.links = {
+      home: 'https://momentjs.com/timezone/',
+      code: 'https://github.com/moment/moment-timezone/'
+    }
+
+    html_filters.push 'moment/clean_html', 'moment_timezone/entries', 'title'
+
+    options[:title] = 'Moment.js Timezone'
+    options[:container] = '.docs-content'
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; JS Foundation and other contributors<br>
+      Licensed under the MIT License.
+    HTML
+
+    def get_latest_version(opts)
+      get_github_tags('moment', 'moment-timezone', opts)[0]['name']
+    end
+  end
+end

二进制
public/icons/docs/moment_timezone/16.png


二进制
public/icons/docs/moment_timezone/16@2x.png


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

@@ -0,0 +1 @@
+https://momentjs.com/static/img/moment-timezone-favicon.png