We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
lookup
lookup is supposed to search for the key literal value, but stuff like dots in it takes effect:
{ "foo.js": { } }
{{lookup . "foo.js"}}
Fails while it should work.
While:
{{lookup . "[foo.js]"}}
Does work, but that's not how lookup in handlebars.js behaves.
I'm also not sure about the behavior in the case of a key that is not found.
The text was updated successfully, but these errors were encountered:
Well... I did this in my project for now:
/** * Lookup helper like [com.github.jknack.handlebars.helper.LookupHelper], but with a bug fix for <https://github.com/jknack/handlebars.java/issues/1035> */ private object LookupHelper : Helper<Any?> { @Throws(IOException::class) override fun apply(context: Any?, options: Options): Any? { if (context == null) { return null } if (options.params.isEmpty()) { return context } val ctx = Context.newBuilder(options.context, context).build() return ctx["[${options.param<Any>(0).toString()}]"] } /** * The helper's name. */ const val NAME = "lookup" }
In Kotlin, but can be easily converted to Java.
Sorry, something went wrong.
No branches or pull requests
lookup
is supposed to search for the key literal value, but stuff like dots in it takes effect:{ "foo.js": { } }
Fails while it should work.
While:
Does work, but that's not how lookup in handlebars.js behaves.
I'm also not sure about the behavior in the case of a key that is not found.
The text was updated successfully, but these errors were encountered: