Merge pull request #5157 from stevecheckoway/fix-hooks-priority-order

Merge pull request 5157
This commit is contained in:
jekyllbot 2016-09-28 16:39:44 -07:00 committed by GitHub
commit 6847b604c8
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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