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

Allow variables as parameters #4

Merged
merged 2 commits into from
Mar 22, 2015
Merged

Allow variables as parameters #4

merged 2 commits into from
Mar 22, 2015

Conversation

pathawks
Copy link
Member

This will first check to see if the passed parameters exist in context and, if so, substitute those values in place of the parameter.

This allows specifying things like the Gist ID in a pages front matter.

---
gist: 1342013

---

{% gist page.gist %}

Added test, but no docs.

Fixes #2

@parkr
Copy link
Member

parkr commented Mar 22, 2015

has_key? is deprecated. Please use key? instead.

@parkr
Copy link
Member

parkr commented Mar 22, 2015

This LGTM, besides the deprecation above.

@pathawks
Copy link
Member Author

undefined method `key?' for #<Liquid::Context:0x007fdb1223bc80>

I'm Googling...

@pathawks
Copy link
Member Author

I found has_key? in the Liquid source code, but I can't find key?

@parkr
Copy link
Member

parkr commented Mar 22, 2015

of course they wouldn't line up with hashes.....

@pathawks
Copy link
Member Author

So has_key? is the way to go after all?

@parkr
Copy link
Member

parkr commented Mar 22, 2015

So has_key? is the way to go after all?

yeah. inconsistent with Ruby's current state. :rage4:

parkr added a commit that referenced this pull request Mar 22, 2015
@parkr parkr merged commit 502e8d2 into jekyll:master Mar 22, 2015
parkr added a commit that referenced this pull request Mar 22, 2015
@pathawks
Copy link
Member Author

eep, you're too fast for me

if context[gist_id]

Should I change this back to

if context.has_key?(gist_id)

@parkr
Copy link
Member

parkr commented Mar 22, 2015

uh yeah I guess. it'll be faster.

sorry, i didn't realize that you changed anything.

@pathawks
Copy link
Member Author

New pull request?

@parkr
Copy link
Member

parkr commented Mar 22, 2015

New pull request?

👍

@pathawks
Copy link
Member Author

#6

@coalwater
Copy link

Thanks @parkr, @pathawks

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace gist id string with a variable
4 participants