Update Moment.js documentation (2.29.4)

pull/1812/head
Simon Legner 2 years ago
parent d8306efebc
commit dbe0b56365

@ -4,7 +4,7 @@ module Docs
def call def call
# Set id attributes on headings # Set id attributes on headings
css('a.docs-section-target', 'a.docs-method-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.next_element['id'] = node['id']
node.remove node.remove
end end

@ -6,10 +6,11 @@ module Docs
Plugins Plugins
Guides:\ External\ Resources) Guides:\ External\ Resources)
IGNORE_IDS = %w( IGNORE_IDS = %w(
i18n-loading-into-nodejs /i18n/loading-into-nodejs/
i18n-loading-into-browser /i18n/loading-into-browser/
i18n-adding-locale /i18n/adding-locale/
i18n-getting-locale) /i18n/getting-locale/
)
def get_name def get_name
if subpath == '/guides/' if subpath == '/guides/'
@ -39,26 +40,30 @@ module Docs
next if IGNORE_TYPES.include?(type) next if IGNORE_TYPES.include?(type)
next if IGNORE_IDS.include?(node['id']) next if IGNORE_IDS.include?(node['id'])
if node['id'] == 'utilities-invalid' # bug fix if %w(Display Durations Get\ +\ Set i18n Manipulate Query Utilities).include?(type) ||
name = 'moment.invalid()' %w(/parsing/is-valid/
elsif node['id'] == 'customization-now' /parsing/parse-zone/
name = 'moment.now' /parsing/unix-timestamp/
elsif %w(Display Durations Get\ +\ Set i18n Manipulate Query Utilities).include?(type) || /parsing/utc/
%w(parsing-is-valid parsing-parse-zone parsing-unix-timestamp parsing-utc parsing-creation-data customization-relative-time-threshold customization-relative-time-rounding /parsing/creation-data/
customization-calendar-format).include?(node['id']) /customization/relative-time-threshold/
/customization/relative-time-rounding/
/customization/calendar-format/
/customization/now/
).include?(node['id'])
name = node.next_element.content[/moment(?:\(.*?\))?\.(?:duration\(\)\.)?\w+/] name = node.next_element.content[/moment(?:\(.*?\))?\.(?:duration\(\)\.)?\w+/]
name.sub! %r{\(.*?\)\.}, '#' name.sub! %r{\(.*?\)\.}, '#'
name << '()' name << '()'
elsif type == 'Customize' elsif type == 'Customize'
name = node.next_element.content[/moment.locale\(.+?\{\s+(\w+)/, 1] name = node.next_element.content[/moment.locale\(.+?\{\s+(\w+)/, 1]
name = node.content.strip unless name
name.prepend 'Locale#' name.prepend 'Locale#'
else else
name = node.content.strip name = node.content.strip
name.remove! %r{\s[\d\.]+[\s\+]*\z} # remove version number
name.remove! %r{\s\(.+\)\z} # remove parenthesis
name.prepend 'Parse: ' if type == 'Parse' name.prepend 'Parse: ' if type == 'Parse'
end end
name.remove! %r{\s[\d\.]+[\s\+]*\z} # remove version number
name.remove! %r{\s\(.+\)\z} # remove parenthesis
entries << [name, node['id'], type] entries << [name, node['id'], type]
end end

@ -3,8 +3,8 @@ module Docs
self.name = 'Moment.js' self.name = 'Moment.js'
self.slug = 'moment' self.slug = 'moment'
self.type = 'moment' self.type = 'moment'
self.release = '2.22.1' self.release = '2.29.4'
self.base_url = 'http://momentjs.com' self.base_url = 'https://momentjs.com'
self.root_path = '/docs/' self.root_path = '/docs/'
self.initial_paths = %w(/guides/) self.initial_paths = %w(/guides/)
self.links = { self.links = {

Loading…
Cancel
Save