Lambda functions & template inheritance interact strangely in Hogan 3.0.0 #80

Closed
MattCheely opened this Issue May 28, 2012 · 2 comments

2 participants

@MattCheely

Lambda functions within replacement blocks in a child template aren't passed the contents of the lamda function's block. Instead they are passed a string of the correct length, but from some other part of the original template. It appears that the start/end indexes for the substring to pass to the lambda are being determined with the {{< foo}} tags in the string, but the substring is being pulled from a string with the {{< foo}} tags removed.

Some sample code to replicate the issue can be found at:
https://gist.github.com/2821130

@MattCheely

Actually, I was way off in my guess at the cause - it was just an artifact of the code I happened to be looking at at the time, or possible of me just not paying enough attention to what I was doing.

Anyway, it seems the root cause is that the lambda function call & lookup of the section of the template to pass to it are happening in the context of the parent template, so the correct value that the lambda isn't even anywhere in the string being parsed (except possibly by coincedence)

@sayrer

thanks for the patch.

@sayrer sayrer closed this Jun 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment