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

Add more APIs to manage extensions of environement #512

Merged
merged 5 commits into from
Sep 15, 2015

Conversation

SamyPesse
Copy link
Contributor

This is PR is just adding 2 methods to the Environment class: removeExtension and hasExtension.

I needed these methods for GitBook, where some “blocks” can be redefined and the previous nunjucks extension needs to be cleanup before.

@SamyPesse
Copy link
Contributor Author

@carljm let me know what you think and if it can be merged into master. I think this PR is not really important for most people, but since extensions can be added, it should be possible to remove these extensions.

@forresst
Copy link
Contributor

If it is accepted, it would be nice to add a description of these two methods to documentation (http://mozilla.github.io/nunjucks/api.html#environment). Personally, I find these two methods very useful.

@carljm
Copy link
Contributor

carljm commented Sep 14, 2015

@SamyPesse This looks fine to me. I agree that these methods should be documented.

@SamyPesse
Copy link
Contributor Author

I've just added a commit that document these methods, but since I'm not an english native, could any of you (@carljm or @forresst) review this last commit ?

getExtension
env.getExtension(name)
Get an extension named **name**.
{% endapi %}

{% api %}
hasExtension
env.hasExtension(name)
Return true if a custom extension named **name** as been added.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/as/has/

@forresst
Copy link
Contributor

LGTM !
I created a PR for documentation in French : #514

@carljm
Copy link
Contributor

carljm commented Sep 15, 2015

Looks good, merging.

carljm added a commit that referenced this pull request Sep 15, 2015
Add more APIs to manage extensions of environment.
@carljm carljm merged commit f84dac6 into master Sep 15, 2015
@carljm carljm deleted the feature/removeExtension branch September 15, 2015 14:27
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.

3 participants