diff --git a/features/hooks.feature b/features/hooks.feature index 075f632a..163f325f 100644 --- a/features/hooks.feature +++ b/features/hooks.feature @@ -235,7 +235,7 @@ Feature: Hooks owner.output = "1 #{owner.output.chomp}" end Jekyll::Hooks.register :pages, :post_render, priority: :high do |owner| - # high runs last + # high runs first owner.output = "2 #{owner.output.chomp}" end Jekyll::Hooks.register :pages, :post_render do |owner| @@ -243,13 +243,13 @@ Feature: Hooks owner.output = "3 #{owner.output.chomp}" end Jekyll::Hooks.register :pages, :post_render, priority: :low do |owner| - # low runs first + # low runs last owner.output = "4 #{owner.output.chomp}" end """ And I have a "index.html" page that contains "WRAP ME" When I run jekyll build - Then I should see "2 3 1 4 WRAP ME" in "_site/index.html" + Then I should see "4 3 1 2 WRAP ME" in "_site/index.html" Scenario: Alter a document right after it is initialized Given I have a _plugins directory diff --git a/lib/jekyll/hooks.rb b/lib/jekyll/hooks.rb index c9a4f794..cbf65ef6 100644 --- a/lib/jekyll/hooks.rb +++ b/lib/jekyll/hooks.rb @@ -80,7 +80,7 @@ module Jekyll end def self.insert_hook(owner, event, priority, &block) - @hook_priority[block] = "#{priority}.#{@hook_priority.size}".to_f + @hook_priority[block] = [-priority, @hook_priority.size] @registry[owner][event] << block end