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

Context param for Include block #214

Merged
merged 7 commits into from
May 10, 2018

Conversation

yonaskolb
Copy link
Collaborator

This is a redo of #95 which only includes the context param which gets passed to the file.
I've also removed the using from the param

{% include "file.stencil" childContext %}

@yonaskolb
Copy link
Collaborator Author

@ilyapuchka @AliSoftware Could I get a review on this?

@@ -25,7 +27,8 @@ class IncludeNode : NodeType {

let template = try context.environment.loadTemplate(name: templateName)

return try context.push {
let subContext = includeContext.flatMap{ context[$0] as? [String: Any] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Side note: seing that makes me wonder if SwiftLint is enabled on Stencil (Doesn't Swiftlint warn about a missing space before {?), could be worth adding if it isn't.

Copy link
Collaborator

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

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

You should also update the docs (at least the one in docs/builtins.rst)

Also, idk how you want to operate from now on now that we're all contributors, but on my other OSS projects I like to add the entries in the CHANGELOG during the PR (in a # master top entry pending release), in order not to forget to list each change when times come to do a release, to avoid adding them only at release time by manually reviewing every PR which had been merged since last release to list them all

@AliSoftware
Copy link
Collaborator

@yonaskolb Also, I'm curious as to why you pushed that on your fork — which should not be necessary anymore now that you're a core contributor and have push access — instead of pushing that branch directly on the original repo?

I'm guessing it's because it's a branch that were already open in your end before you became one of the co-owners (actually you don't seem to have accepted my invitation to be part of the team?), but that would still give you some more power (add reviewers, etc), so 😉

Usually in most projects, CI is disabled for forks for security reasons (would otherwise allow some ill-intended user to expose tokens otherwise, iirc), so pushing a branch on the main repo rather than the fork is generally preferred when possible also for that reason (even if idk if that's the case for Stencil, would have to check on travis).
Also would allow you to get rid of your fork and avoid having to maintain 2 different remotes for the same project and the pain of having to keep them in sync 😉

@yonaskolb
Copy link
Collaborator Author

Thanks @AliSoftware, comments addressed.

Yeah if no one person is managing releases we should add changelog entries in PRs 👍

Yes, the branch is just an older one from my fork.
Any future work will be in this repo 👍

CHANGELOG.md Outdated
@@ -2,6 +2,10 @@

## Master

### Enhancements

- added an optional second parameter to the `include` tag for passing a sub context to the included file
Copy link
Contributor

@djbe djbe May 7, 2018

Choose a reason for hiding this comment

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

Maybe we should directly start applying the new changelog format? End with a . (dot + 2 spaces), and the author + issue link. See https://github.com/SwiftGen/SwiftGen/blob/master/CHANGELOG.md for examples.

Nitpick: start sentences with an uppercase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cool, done

@yonaskolb yonaskolb merged commit d935f65 into stencilproject:master May 10, 2018
@djbe djbe added this to the 0.12.0 milestone Jul 12, 2018
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.

None yet

3 participants