Class: Jekyll::Tags::PostComparer

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-multiple-languages-plugin.rb

Overview

Override of core Jekyll functionality, to get rid of deprecation warning. See github.com/jekyll/jekyll/pull/7117 for more details.

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ PostComparer

Returns a new instance of PostComparer.



448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/jekyll-multiple-languages-plugin.rb', line 448

def initialize(name)
  @name = name

  all, @path, @date, @slug = *name.sub(%r!^/!, "").match(MATCHER)
  unless all
    raise Jekyll::Errors::InvalidPostNameError,
          "'#{name}' does not contain valid date and/or title."
  end

  escaped_slug = Regexp.escape(slug)
  @name_regex = %r!_posts/#{path}#{date}-#{escaped_slug}\.[^.]+|
    ^#{path}_posts/?#{date}-#{escaped_slug}\.[^.]+!x
end