Update Moment.js documentation (2.8.1)

This commit is contained in:
Thibaut 2014-08-10 09:05:33 -04:00
parent bf283d5234
commit 77f62b44d0
3 changed files with 13 additions and 11 deletions

View file

@ -3,11 +3,12 @@ module Docs
class CleanHtmlFilter < Filter
def call
# Set id attributes on headings
css('a.target').each do |node|
css('a.docs-section-target', 'a.docs-method-target').each do |node|
node.next_element['id'] = node['name'].remove(/\A\//).remove(/\/\z/).gsub('/', '-')
node.remove
end
css('> article', '.prose', 'h2 > a', 'h3 > a', 'pre > code').each do |node|
css('> article', '.docs-method-prose', '.docs-method-signature', 'h2 > a', 'h3 > a', 'pre > code').each do |node|
node.before(node.children).remove
end
@ -17,7 +18,7 @@ module Docs
# Remove plugin list
doc.children.last.remove while doc.children.last['id'] != 'plugins'
css('.hash', '#plugins').remove
css('.docs-method-edit', '#plugins').remove
doc
end

View file

@ -4,8 +4,8 @@ module Docs
IGNORE_IDS = %w(
i18n-loading-into-nodejs
i18n-loading-into-browser
i18n-adding-language
i18n-getting-language)
i18n-adding-locale
i18n-getting-locale)
def additional_entries
entries = []
@ -17,21 +17,22 @@ module Docs
next
end
next unless node.name == 'h3'
next if IGNORE_IDS.include?(node['id'])
if node['id'] == 'utilities-invalid' # bug fix
name = 'moment.invalid()'
elsif %w(Display Durations Get\ +\ Set i18n Manipulate Query Utilities).include?(type) ||
%w(parsing-is-valid parsing-parse-zone parsing-unix-timestamp parsing-utc).include?(node['id'])
%w(parsing-is-valid parsing-parse-zone parsing-unix-timestamp parsing-utc customization-relative-time-threshold).include?(node['id'])
name = node.next_element.content[/moment(?:\(.*?\))?\.(?:duration\(\)\.)?\w+/]
name.sub! %r{\(.*?\)\.}, '#'
name << '()'
elsif type == 'Customize'
name = node.next_element.content[/moment.lang\(.+?\{\s+(\w+)/, 1]
name.prepend 'Language#'
name = node.next_element.content[/moment.locale\(.+?\{\s+(\w+)/, 1]
name.prepend 'Locale#'
else
name = node.content.strip
name.remove! %r{\s[\d\.]+\z} # remove version number
name.remove! %r{\s[\d\.]+[\s\+]*\z} # remove version number
name.remove! %r{\s\(.+\)\z} # remove parenthesis
name.prepend 'Parse: ' if type == 'Parse'
end

View file

@ -3,13 +3,13 @@ module Docs
self.name = 'Moment.js'
self.slug = 'moment'
self.type = 'moment'
self.version = '2.7.0'
self.version = '2.8.1'
self.base_url = 'http://momentjs.com/docs/'
html_filters.push 'moment/clean_html', 'moment/entries', 'title'
options[:title] = 'Moment.js'
options[:container] = '.docs'
options[:container] = '.docs-content'
options[:skip_links] = true
options[:attribution] = <<-HTML