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

Conversation

Projects
None yet
3 participants
@parkr
Member

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

This comment has been minimized.

Member

gjtorikian commented Apr 22, 2014

Sweet!

@parkr

This comment has been minimized.

Member

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 from Add Jekyll::Utils.lookup_variable to Add Jekyll::LiquidExtensions.lookup_variable Apr 22, 2014

@parkr

This comment has been minimized.

Member

parkr commented Apr 22, 2014

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

Add Jekyll::LiquidExtensions.lookup_variable
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 added Enhancement and removed Enhancement labels 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

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@parkr parkr deleted the var-substitution branch Apr 22, 2014

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.