diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml index b9fb4d0..41e09cb 100644 --- a/specs/~lambdas.yml +++ b/specs/~lambdas.yml @@ -107,6 +107,40 @@ tests: template: "<{{#lambda}}-{{/lambda}}>" expected: "<-Earth->" + - name: Section - Expansion of List Elements + desc: Lambdas used for sections in a list should each have their results parsed. + data: + planet: "Earth" + lambdas: + - !code + python: 'lambda text: "~{{%s}}~" % text' + - !code + python: 'lambda text: "#{{%s}}#" % text' + template: "<{{#lambdas}}planet{{/lambdas}}>" + expected: "<~Earth~#Earth#>" + + - name: Section - Context Stack + desc: | + Lambdas used for sections should not be pushed onto the context + stack before rendering their return value. + data: + planet: "Earth" + star: "Sun" + lambda: !code + python: 'lambda text: "~{{star}} %s {{.}}~" % text' + template: "<{{#planet}}{{#lambda}}&{{/lambda}}{{/planet}}>" + expected: "<~Sun & Earth~>" + + - name: Section - No Re-interpolation + desc: The lambda return value should not be re-interpolated. + data: + planet: "Earth" + dot: "#{{.}}#" + lambda: !code + python: 'lambda text: "~{{%s}}~" % text' + template: "<{{#planet}}{{#lambda}}dot{{/lambda}}{{/planet}}>" + expected: "<~#{{.}}#~>" + - name: Section - Alternate Delimiters desc: Lambdas used for sections should parse with the current delimiters. data: