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
base: dev
from

Conversation

Projects
None yet
@Delapouite
Member

Delapouite commented Aug 20, 2013

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 some commits Nov 29, 2012

v6.14.0. Improvement.
- 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. Improvement.
- v6.15.0 December 3, 2012
	- [Nodejitsu](http://nodejitsu.com/) Support
v6.16.0. Improvement.
- 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 #359](#359)
for more information
Cleaned up the Meta Data handling
- 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. Clean.
- 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. Improvement.
- v6.17.1 December 4, 2012
	- Updated misc internals to use the new `File::getOutContent` call
v6.17.2. Bugfix.
- 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 [#369](#369),
[#368](#368),
[#366](#366)
v6.17.3. Bugfix.
- 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
#370](#370) and [pull request
#371](#371)
v6.18.0. Improvement.
- 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 #378](#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. Improvement.
- 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. Improvement.
- 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. Bugfix.
- v6.20.1 December 24, 2012
	- Fixed `File::writeSource`
		- Thanks to [ashnur](https://github.com/ashnur) for [pull request
#381](#381)

balupton and others added some commits Aug 14, 2013

Merge pull request #598 from Delapouite/master
fixed missing progress option for loadFiles step
v6.49.1. Bugfix.
- 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 #498](#598)
v6.49.2. Improvement.
- 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. Improvement.
- 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

This comment has been minimized.

Member

balupton commented Aug 20, 2013

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

@Delapouite

This comment has been minimized.

Member

Delapouite commented Aug 20, 2013

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

This comment has been minimized.

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

This comment has been minimized.

Member

balupton commented Sep 7, 2013

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

@Delapouite

This comment has been minimized.

Member

Delapouite commented Sep 9, 2013

Yes, done.

@balupton

This comment has been minimized.

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

This comment has been minimized.

Member

balupton commented Oct 26, 2013

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

This comment has been minimized.

Member

balupton commented Oct 26, 2013

Released to v6.54.0 October 27, 2013

@greduan

This comment has been minimized.

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

This comment has been minimized.

Member

balupton commented Oct 26, 2013

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

@greduan

This comment has been minimized.

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

This comment has been minimized.

Member

Delapouite commented Oct 28, 2013

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

This comment has been minimized.

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

This comment has been minimized.

Member

Delapouite commented Oct 28, 2013

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

This comment has been minimized.

Contributor

greduan commented Oct 28, 2013

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

@greduan

This comment has been minimized.

Contributor

greduan commented Oct 28, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment