Permalink
Browse files

Merged in a2e4502

  • Loading branch information...
1 parent fdbb72a commit e1410cf636cd49d5a352cf6e3bea25fd001cc068 @Delapouite Delapouite committed with balupton Aug 20, 2013
Showing with 28 additions and 15 deletions.
  1. +28 −15 src/lib/docpad.coffee
View
@@ -217,8 +217,10 @@ class DocPad extends EventEmitterGrouped
'contextualizeBefore'
'contextualizeAfter'
'renderBefore'
+ 'renderCollectionBefore'
'render' # fired for each extension conversion
'renderDocument' # fired for each document render, including layouts and render passes
+ 'renderCollectionAfter'
'renderAfter'
'writeBefore'
'writeAfter'
@@ -3039,23 +3041,34 @@ class DocPad extends EventEmitterGrouped
# Render Collection
renderCollection = (collectionToRender,{renderPass},next) ->
- # Prepare
- subTasks = new TaskGroup().setConfig(concurrency:0).once('complete',next)
+ # Plugin Event
+ docpad.emitSerial 'renderCollectionBefore', {collection:collectionToRender,renderPass}, (err) =>
+ # Prepare
+ return next(err) if err
- # Cycle
- step = "renderFiles (pass #{renderPass})"
- opts.progress?.step(step).total(collectionToRender.length)
- collectionToRender.forEach (file) ->
- slowFilesObject[file.id] = file.get('relativePath')
- subTasks.addTask (complete) ->
- renderFile file, (err) ->
- delete slowFilesObject[file.id] or file.id
- opts.progress?.tick()
- return complete(err)
+ subTasks = new TaskGroup().setConfig(concurrency:0).once 'complete', (err) ->
+ # Plugin Event
+ docpad.emitSerial 'renderCollectionAfter', {collection:collectionToRender,renderPass}, (err) ->
+ # Prepare
+ return next(err) if err
- # Return
- subTasks.run()
- return collectionToRender
+ # Done
+ return next()
+
+ # Cycle
+ step = "renderFiles (pass #{renderPass})"
+ opts.progress?.step(step).total(collectionToRender.length)
+ collectionToRender.forEach (file) ->
+ slowFilesObject[file.id] = file.get('relativePath')
+ subTasks.addTask (complete) ->
+ renderFile file, (err) ->
+ delete slowFilesObject[file.id] or file.id
+ opts.progress?.tick()
+ return complete(err)
+
+ # Return
+ subTasks.run()
+ return collectionToRender
# Plugin Event
docpad.emitSerial 'renderBefore', {collection,templateData}, (err) =>

1 comment on commit e1410cf

Owner

balupton commented on e1410cf Oct 26, 2013

Had to fix this up a bit here: 0862c44#diff-e6948c0fbbce10ea9b720d5249d50c1dR3020

Without this, render errors were not displayed.

Please sign in to comment.