helpers / handlebars-helper-lorem

{{lorem}} handlebars helper, for generating lorem lorem placeholder text.
http://assemble.io/helpers/
MIT License
5 stars 0 forks source link

Making the {{lorem}} tag configurable #1

Closed andymantell closed 9 years ago

andymantell commented 9 years ago

Hi,

I am trying to use the following tag:

{{lorem count=4}}

to output a 4 sentence paragraph of lorem. However, the configuration options don't stick. I did a bit of debugging and discovered that with the above example, the context variable received by the plugin looks like this:

{
  hash: {
    count: 4
  }
}

But in the plugin the code is as follows:

var text = loremIpsum(_.extend({
  count: 1,
  ... snip ...
}, context));

If I change that to extend context.hash then it works as expected.

I would submit a pull request but figured I'd ask first as I'm new to using assemble.io. Is there something I've misunderstood here?

jonschlinkert commented 9 years ago

I'll take a look, thx for reporting

jonschlinkert commented 9 years ago

yes, you're absolutely correct. The context is messed up. I'm fixing this now

jonschlinkert commented 9 years ago

Refactored, please see: https://github.com/helpers/handlebars-helper-lorem/commit/d67adc5bf52c144abe72d75f2189ff46b0c1de76. Let me know if this works for you. fwiw, Assemble v0.6.0 is coming out this week, and helpers are far easier to use and register with this upcoming version.

Also, based v0.2.0 on a generic helper that can be used with any engine.

closing this, but please feel free to open a new issue if you have problems with v0.2.0