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 Jekyll::LiquidExtensions.lookup_variable #2253

Merged
merged 1 commit into from Apr 22, 2014
Merged

Conversation

parkr
Copy link
Member

@parkr parkr commented Apr 22, 2014

To use, just include Jekyll::LiquidExtensions as you please:

class SayHi < Liquid::Tag
  include Jekyll::LiquidExtensions

  def initialize(tag_name, markup, tokens)
    @markup = markup.strip
  end

  def render(context)
    "hi #{lookup_variable(context, @markup)}"
  end
end

Fixes #2071.

/cc @gjtorikian

@gjtorikian
Copy link
Member

Sweet!

@parkr
Copy link
Member Author

parkr commented Apr 22, 2014

@gjtorikian Is this an OK place to put it? Only other place I would consider is a Jekyll::LiquidExtensions module that people could include into their tags.

@parkr parkr changed the title Add Jekyll::Utils.lookup_variable Add Jekyll::LiquidExtensions.lookup_variable Apr 22, 2014
@parkr
Copy link
Member Author

parkr commented Apr 22, 2014

Using a module instead of Jekyll::Utils. Yay for one more module!

To use, just include `Jekyll::LiquidExtensions` as you please:

```ruby
class SayHi < Liquid::Tag
  include Jekyll::LiquidExtensions

  def initialize(tag_name, markup, tokens)
    @markup = markup.strip
  end

  def render(context)
    "hi #{lookup_variable(context, @markup)}"
  end
end
```

Fixes #2071.
@parkr parkr added this to the 2.0 milestone Apr 22, 2014
@parkr parkr self-assigned this Apr 22, 2014
parkr added a commit that referenced this pull request Apr 22, 2014
@parkr parkr merged commit 54d0c63 into master Apr 22, 2014
@parkr parkr deleted the var-substitution branch April 22, 2014 18:56
parkr added a commit that referenced this pull request Apr 22, 2014
@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.

Expose var substitution paradigm
3 participants