diff --git a/lib/docs/filters/moment/clean_html.rb b/lib/docs/filters/moment/clean_html.rb index be7d58d0..eb791209 100644 --- a/lib/docs/filters/moment/clean_html.rb +++ b/lib/docs/filters/moment/clean_html.rb @@ -4,7 +4,7 @@ module Docs def call # Set id attributes on headings 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 end diff --git a/lib/docs/filters/moment/entries.rb b/lib/docs/filters/moment/entries.rb index 805ae68f..c7b6e5f9 100644 --- a/lib/docs/filters/moment/entries.rb +++ b/lib/docs/filters/moment/entries.rb @@ -6,10 +6,11 @@ module Docs Plugins Guides:\ External\ Resources) IGNORE_IDS = %w( - i18n-loading-into-nodejs - i18n-loading-into-browser - i18n-adding-locale - i18n-getting-locale) + /i18n/loading-into-nodejs/ + /i18n/loading-into-browser/ + /i18n/adding-locale/ + /i18n/getting-locale/ + ) def get_name if subpath == '/guides/' @@ -39,26 +40,30 @@ module Docs next if IGNORE_TYPES.include?(type) next if IGNORE_IDS.include?(node['id']) - if node['id'] == 'utilities-invalid' # bug fix - name = 'moment.invalid()' - elsif node['id'] == 'customization-now' - name = 'moment.now' - elsif %w(Display Durations Get\ +\ Set i18n Manipulate Query Utilities).include?(type) || - %w(parsing-is-valid parsing-parse-zone parsing-unix-timestamp parsing-utc parsing-creation-data customization-relative-time-threshold customization-relative-time-rounding - customization-calendar-format).include?(node['id']) + if %w(Display Durations Get\ +\ Set i18n Manipulate Query Utilities).include?(type) || + %w(/parsing/is-valid/ + /parsing/parse-zone/ + /parsing/unix-timestamp/ + /parsing/utc/ + /parsing/creation-data/ + /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.sub! %r{\(.*?\)\.}, '#' name << '()' elsif type == 'Customize' name = node.next_element.content[/moment.locale\(.+?\{\s+(\w+)/, 1] + name = node.content.strip unless name name.prepend 'Locale#' else 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' end - + name.remove! %r{\s[\d\.]+[\s\+]*\z} # remove version number + name.remove! %r{\s\(.+\)\z} # remove parenthesis entries << [name, node['id'], type] end diff --git a/lib/docs/scrapers/moment.rb b/lib/docs/scrapers/moment.rb index e74163be..8d56470d 100644 --- a/lib/docs/scrapers/moment.rb +++ b/lib/docs/scrapers/moment.rb @@ -3,8 +3,8 @@ module Docs self.name = 'Moment.js' self.slug = 'moment' self.type = 'moment' - self.release = '2.22.1' - self.base_url = 'http://momentjs.com' + self.release = '2.29.4' + self.base_url = 'https://momentjs.com' self.root_path = '/docs/' self.initial_paths = %w(/guides/) self.links = {