History

Add Moment.js Timezone (0.5.37)

Tim Lim committed 4 years ago

Commit 85036641 parent 666d6559 files · +92 −-2Browse files

Unified · Split

9 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  2. assets/stylesheets/application.css.scss +1 −0
  3. assets/stylesheets/pages/_moment_timezone.scss +5 −0
  4. lib/docs/filters/moment_timezone/clean_html.rb +29 −0
  5. lib/docs/filters/moment_timezone/entries.rb +23 −0
  6. lib/docs/scrapers/moment_timezone.rb +30 −0
  7. public/icons/docs/moment_timezone/16.png +0 −0
  8. public/icons/docs/moment_timezone/16@2x.png +0 −0
  9. public/icons/docs/moment_timezone/SOURCE +1 −0
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -581,6 +581,11 @@ credits = [ · 580 unmodified lines
581581 'JS Foundation and other contributors',
582582 'MIT',
583583 'https://raw.githubusercontent.com/moment/moment/master/LICENSE'
584+ ], [
585+ 'Moment.js Timezone',
586+ 'JS Foundation and other contributors',
587+ 'MIT',
588+ 'https://raw.githubusercontent.com/moment/moment-timezone/master/LICENSE'
584589 ], [
585590 'Mongoose',
586591 '2010 LearnBoost',
assets/stylesheets/application.css.scss+1−0
@@ -87,6 +87,7 @@ · 86 unmodified lines
8787 'pages/mkdocs',
8888 'pages/modernizr',
8989 'pages/moment',
90+ 'pages/moment_timezone',
9091 'pages/nginx',
9192 'pages/node',
9293 'pages/npm',
assets/stylesheets/pages/_moment_timezone.scss+5−0
@@ -0,0 +1,5 @@
1+._moment_timezone {
2+ > h2 { @extend %block-heading; }
3+ > h3 { @extend %block-label, %label-blue; }
4+ code { @extend %label; }
5+}
lib/docs/filters/moment_timezone/clean_html.rb+29−0
@@ -0,0 +1,29 @@
1+module Docs
2+ class MomentTimezone
3+ class CleanHtmlFilter < Filter
4+ def call
5+ # Set id attributes on headings
6+ css('a.docs-section-target', 'a.docs-method-target').each do |node|
7+ node.next_element['id'] = node['id']
8+ node.remove
9+ end
10+
11+ css('> article', '.docs-method-prose', '.docs-method-signature', 'h2 > a', 'h3 > a', 'pre > code').each do |node|
12+ node.before(node.children).remove
13+ end
14+
15+ css('.docs-method-edit', 'hr').remove
16+
17+ css('pre').each do |node|
18+ if node.content =~ /\A</
19+ node['data-language'] = 'html'
20+ elsif node.content !~ /\A\d/
21+ node['data-language'] = 'javascript'
22+ end
23+ end
24+
25+ doc
26+ end
27+ end
28+ end
29+end
lib/docs/filters/moment_timezone/entries.rb+23−0
@@ -0,0 +1,23 @@
1+module Docs
2+ class MomentTimezone
3+ class EntriesFilter < Docs::EntriesFilter
4+
5+ def additional_entries
6+ entries = []
7+ type = nil
8+
9+ css('[id]').each do |node|
10+ if node.name == 'h2'
11+ type = node.content
12+ name = "Intro"
13+ else
14+ name = node.content.strip
15+ end
16+ entries << [name, node['id'], type]
17+ end
18+
19+ entries
20+ end
21+ end
22+ end
23+end
lib/docs/scrapers/moment_timezone.rb+30−0
@@ -0,0 +1,30 @@
1+module Docs
2+ class MomentTimezone < UrlScraper
3+ self.name = 'Moment.js Timezone'
4+ self.slug = 'moment_timezone'
5+ self.type = 'moment_timezone'
6+ self.release = '0.5.37'
7+ self.base_url = 'https://momentjs.com/timezone'
8+ self.root_path = '/docs/'
9+ self.initial_paths = %w(/docs/)
10+ self.links = {
11+ home: 'http://momentjs.com/timezone/',
12+ code: 'https://github.com/moment/moment-timezone/'
13+ }
14+
15+ html_filters.push 'moment_timezone/clean_html', 'moment_timezone/entries', 'title'
16+
17+ options[:title] = 'Moment.js Timezone'
18+ options[:container] = '.docs-content'
19+ options[:skip_links] = true
20+
21+ options[:attribution] = <<-HTML
22+ &copy; JS Foundation and other contributors<br>
23+ Licensed under the MIT License.
24+ HTML
25+
26+ def get_latest_version(opts)
27+ get_github_tags('moment', 'moment-timezone', opts)[0]['name']
28+ end
29+ end
30+end
public/icons/docs/moment_timezone/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/moment_timezone/SOURCE+1−0
@@ -0,0 +1 @@
1+https://momentjs.com/static/img/moment-timezone-favicon.png