Commit Graph

9 Commits

Author SHA1 Message Date
Stephen Checkoway 6167c09569 Run hooks in priority order.
Low priority hooks are being run before higher priority hooks. This is easy to
demonstrate with the following plugin:

    1.upto(10).each do |n|
      Jekyll::Hooks.register :site, :after_reset, priority: Jekyll::Hooks::PRIORITY_MAP[:low] do
        puts "Low #{n}"
      end
      Jekyll::Hooks.register :site, :after_reset, priority: Jekyll::Hooks::PRIORITY_MAP[:normal] do
        puts "Normal #{n}"
      end
      Jekyll::Hooks.register :site, :after_reset, priority: Jekyll::Hooks::PRIORITY_MAP[:high] do
        puts "High #{n}"
      end
    end

Sorting by the negative of the priority and then by the order the hook was
added does the right thing.
2016-08-06 20:56:34 -05:00
Nathan Hazout d1f4d874be Added a scenario for #4414 2016-06-15 11:21:02 +03:00
Parker Moore 736a800f0e features: validate the exit status of 0 for successful calls 2016-01-18 11:52:31 -08:00
Parker Moore 2756503e7b features/hooks: use hash syntax to access page 2016-01-04 12:37:19 -08:00
Parker Moore 30ceda52ef features/hooks: global payload _is_ global -- not new for each page 2015-12-22 21:36:15 -05:00
Parker Moore b89f943bf2 collections: posts as collection 2015-10-26 00:29:14 -07:00
Stephen Crosby 736e6a78f1 address code review feedback from #3553
- change site:reset to site:after_reset
- raise an exception when registering uncallable hook
- set default hook priority at the public API level
2015-05-02 15:56:19 -07:00
Stephen Crosby 245d9677d7 Refine hook implementation
- hooks are registered to symbol owners rather than classes directly
- during registration, add the ability to specify owner as an array to
  register the same hook to multiple owners
- add optional priority during registration as a symbol (:low, :normal,
  :high)
- implement hooks for collections as they are in octopress-hooks, aside
  from post_init
2015-05-01 19:00:37 -07:00
Stephen Crosby 6ca9633354 prototype of jekyll hooks, encapsulated 2015-05-01 14:35:15 -07:00