Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added renderCollectionBefore and renderCollectionAfter events #608

Closed
wants to merge 766 commits into from

Conversation

Delapouite
Copy link
Contributor

Hi

This PR adds a new before/after events couple.

The renderCollection events are triggered once per renderPass which lets plugins handle more granular action than the generic renderBefore / renderAfter events :

renderBefore
renderCollectionBefore (pass 1)
renderCollectionAfter (pass 1)
renderCollectionBefore (pass 2)
renderCollectionAfter (pass2)
[pass 3, 4 ... if enabled]
renderAfter

balupton and others added 30 commits November 29, 2012 13:45
- v6.14.0 November 29, 2012
	- Added  `DocPad::getFileByUrl(url)` and updated the middleware router
to use it
		- Big performance gain on request response time
- v6.15.0 December 3, 2012
	- [Nodejitsu](http://nodejitsu.com/) Support
- v6.16.0 December 4, 2012
	- The amount of render passes is now customisable via the
`renderPasses` configuration option, defaults to `1`
		- Increment this value dependening on how many levels of
cross-document references you have (e.g. 2 passes for C includes B, B
includes A)
	- The render pass functionality has been changed to render all
documents that don't reference anything else first, then for each
additional render pass, render documents that do reference others
		- Previously it would render both types of documents in the one
batch, which resulted in hit and miss results
		- Doing this, we now safely have the default `renderPasses` value set
to `1` which has the same effect as the traditional `2` render pass
		- Refer to [issue docpad#359](docpad#359)
for more information
- Removed useless `Document::initialize` and `Document::getMeta`
- Updated `File::getMeta` to create meta if it doesn't exist yet
- Added `Base::setDefaults`, `File::setMeta`, and
`File::setMetaDefaults`
- v6.17.0 December 4, 2012
	- Updated
		- `File::getMeta` to create meta if it doesn't exist yet
	- Removed
		-  `Document::initialize` didn't do anything
		-  `Document::getMeta` didn't do anything
		-  `File::readFile` merged into `File::parse`
		- `File::parseData` renamed to `File::parse` and cleaned signficantly
	- Added
		- `Base::setDefaults` to update attributes that haven't been set
		- `File::setMeta` to update the meta more easily than
`File.getMeta().set`
		- `File::setMetaDefaults` to update the meta attributes that haven't
been set
		- `File::getContent` to get the content or buffer
		- `File::getOutContent` to get the rendered content, or content, or
buffer
		- `File::getStat` to get the stat
		- `File::setBuffer` to set the buffer
		- `File::getBuffer` to get the buffer
- v6.17.1 December 4, 2012
	- Updated misc internals to use the new `File::getOutContent` call
- v6.17.2 December 5, 2012
	- `watch` and `server` actions now perform an initial generation
		- Thanks [Khalid Jebbari](https://github.com/DjebbZ), [Vladislav
Botvin](https://github.com/darrrk)
		- Closes [docpad#369](docpad#369),
[docpad#368](docpad#368),
[docpad#366](docpad#366)
- v6.17.3 December 5, 2012
	- Fixed an issue introduced in v6.17.0 that prevented files from
reloading under certain circumstances
		- Thanks [Vladislav Botvin](https://github.com/darrrk) for [issue
docpad#370](docpad#370) and [pull request
docpad#371](docpad#371)
- v6.18.0 December 14, 2012
	- Added `regeneratePaths` configuration option
	- Include now returns expected results if the content hasn't been
rendered yet
		- Closes [issue docpad#378](docpad#378)
	- Updated [QueryEngine](https://github.com/bevry/query-engine/) to
v1.5.x from v1.4.x
	- [Backbone](http://backbonejs.org/) dependency now moved to our
dependencies from QueryEngine's. Version set explicitly to v0.9.9.
		- If you have any plugins or whatever that used the
`myCollection.getByCid` function, change that call to `myCollection.get`
	- Improved help URLs
- v6.19.0 December 15, 2012
	- Renamed `ignorePatterns` configuration option to
`ignoreCommonPatterns` and added new `ignoreCustomPatterns`
configuration option
	- Updated dependencies
		- [bal-util](https://github.com/balupton/bal-util) from 1.14.x to
~1.15.2
		- [watchr](https://github.com/bevry/watchr) from 2.1.x to ~2.2.1
	- Updated optional dependencies
		- [mixpanel](https://github.com/carlsverre/mixpanel-node) from 0.0.9
to 0.0.10
	- Updated dev dependencies
		- [chai](https://github.com/chaijs/chai) from 1.3.x to 1.4.x
- v6.20.0 December 17, 2012
	- Better watch handling
	- Updated dependencies
		- [watchr](https://github.com/bevry/watchr) from ~2.2.1 to 2.3.x
- v6.20.1 December 24, 2012
	- Fixed `File::writeSource`
		- Thanks to [ashnur](https://github.com/ashnur) for [pull request
docpad#381](docpad#381)
balupton and others added 8 commits August 13, 2013 19:49
fixed missing progress option for loadFiles step
- v6.49.1 August 14, 2013
	- `loadFiles` step is now properly reported in the progress bar
		- Thanks to [Bruno Heridet](https://github.com/Delapouite) for [pull
request docpad#498](docpad#598)
- v6.49.2 August 20, 2013
	- Fixed `File::deleteSource`
	- Plugin tester will now try to init the plugin test directory if there are tests defined (useful for plugins which tests start from scratch)
	- Updated dependencies
- v6.50.0 August 20, 2013
	- Upgraded from commander v1.3 to v2 (removes commander prompts)
	- We now use promptly for prompts
	- Updated dependencies
@balupton
Copy link
Member

Interesting. What is a plugin / use case that needs this?

@Delapouite
Copy link
Contributor Author

Yes, I found myself needing to create extras folders in the out directory only during the second pass when the collection to render contains specific documents.

@balupton
Copy link
Member

balupton commented Sep 1, 2013

Let's keep populateCollectionsAfter as populateCollections for b/c compatibility, otherwise we'd break a whole bunch of plugins. Other than that, looks good.

@balupton
Copy link
Member

balupton commented Sep 7, 2013

Would you be able to do that rename of populateCollectionsAfter back to populateCollections for me?

@Delapouite
Copy link
Contributor Author

Yes, done.

@balupton
Copy link
Member

balupton commented Sep 9, 2013

Sweet, will add it to the queue of things :)

@balupton balupton closed this Oct 23, 2013
@balupton balupton reopened this Oct 26, 2013
@balupton balupton closed this Oct 26, 2013
@balupton
Copy link
Member

Seemed my rewrite to remove media from the repository is what caused all the duplicate commits.

Seemed my deletion of dev branch causes this to close.

Cherry-picked the changes into dev-updates

balupton added a commit that referenced this pull request Oct 26, 2013
balupton added a commit that referenced this pull request Oct 26, 2013
@balupton
Copy link
Member

Released to v6.54.0 October 27, 2013

@greduan
Copy link
Contributor

greduan commented Oct 26, 2013

@balupton If you can tell me what these events do specifically I can add them to the documentation for you if you want. :)

@balupton
Copy link
Member

:) great, #608 (comment) is all I know about them

@greduan
Copy link
Contributor

greduan commented Oct 26, 2013

@Delapouite Perhaps you could give me a little more insight so that I can give clear and concise info on the new events?

@Delapouite
Copy link
Contributor Author

Sure. DocPad has a renderPasses option : http://docpad.org/docs/config#available-configuration

    # Render Passes
    # How many times should we render documents that reference other documents?
    renderPasses: 1  # default

So if you set this value to 3, you'll get 3 renderCollectionBefore/After events, one for each render pass.

@greduan
Copy link
Contributor

greduan commented Oct 28, 2013

On the list of render events, where do they go exactly? Just so that I don't mess up the order. :)

@Delapouite
Copy link
Contributor Author

They are triggered between the usual renderBefore / renderAfter events :

renderBefore
renderCollectionBefore (pass 1)
renderCollectionAfter (pass 1)
renderCollectionBefore (pass 2)
renderCollectionAfter (pass2)
[pass 3, 4 ... if enabled]
renderAfter

@greduan
Copy link
Contributor

greduan commented Oct 28, 2013

Got it. Writing it in my branch of the documentation. Thanks! :)

@greduan
Copy link
Contributor

greduan commented Oct 28, 2013

@Delapouite Pushed commit. Is that right? docpad-archive/documentation@42a2008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.