Skip to content

Commit

Permalink
Merge branch 'v1.0'
Browse files Browse the repository at this point in the history
Conflicts:
	Changes
  • Loading branch information
pvande committed Mar 20, 2011
2 parents 3e800d1 + 48c933b commit 6d8e60e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Changes
@@ -1,8 +1,10 @@
2011-03-??: v1.1.2 2011-03-??: v1.1.2
Added tests for standalone tags at string boundaries. Added tests for standalone tags at string boundaries.
Added tests for rendering lambda returns after delimiter changes.


2011-03-??: v1.0.3 2011-03-20: v1.0.3
Added tests for standalone tags at string boundaries. Added tests for standalone tags at string boundaries.
Added tests for rendering lambda returns after delimiter changes.


2011-03-05: v1.1.1 2011-03-05: v1.1.1
Added tests for indented inline sections. Added tests for indented inline sections.
Expand Down
33 changes: 30 additions & 3 deletions specs/~lambdas.yml
Expand Up @@ -4,12 +4,13 @@ overview: |
When used as the data value for an Interpolation tag, the lambda MUST be When used as the data value for an Interpolation tag, the lambda MUST be
treatable as an arity 0 function, and invoked as such. The returned value treatable as an arity 0 function, and invoked as such. The returned value
MUST be rendered, then interpolated in place of the lambda. MUST be rendered against the default delimiters, then interpolated in place
of the lambda.
When used as the data value for a Section tag, the lambda MUST be treatable When used as the data value for a Section tag, the lambda MUST be treatable
as an arity 1 function, and invoked as such (passing a String containing the as an arity 1 function, and invoked as such (passing a String containing the
unprocessed section contents). The returned value MUST be rendered, then unprocessed section contents). The returned value MUST be rendered against
interpolated in place of the section. the current delimiters, then interpolated in place of the section.
tests: tests:
- name: Interpolation - name: Interpolation
desc: A lambda's return value should be interpolated. desc: A lambda's return value should be interpolated.
Expand All @@ -36,6 +37,19 @@ tests:
template: "Hello, {{lambda}}!" template: "Hello, {{lambda}}!"
expected: "Hello, world!" expected: "Hello, world!"


- name: Interpolation - Alternate Delimiters
desc: A lambda's return value should parse with the default delimiters.
data:
planet: "world"
lambda: !code
ruby: 'proc { "|planet| => {{planet}}" }'
perl: 'sub { "|planet| => {{planet}}" }'
js: 'function() { return "|planet| => {{planet}}" }'
php: 'return "|planet| => {{planet}}";'
python: 'lambda: "|planet| => {{planet}}"'
template: "{{= | | =}}\nHello, (|&lambda|)!"
expected: "Hello, (|planet| => world)!"

- name: Interpolation - Multiple Calls - name: Interpolation - Multiple Calls
desc: Interpolated lambdas should not be cached. desc: Interpolated lambdas should not be cached.
data: data:
Expand Down Expand Up @@ -86,6 +100,19 @@ tests:
template: "<{{#lambda}}-{{/lambda}}>" template: "<{{#lambda}}-{{/lambda}}>"
expected: "<-Earth->" expected: "<-Earth->"


- name: Section - Alternate Delimiters
desc: Lambdas used for sections should parse with the current delimiters.
data:
planet: "Earth"
lambda: !code
ruby: 'proc { |text| "#{text}{{planet}} => |planet|#{text}" }'
perl: 'sub { $_[0] . "{{planet}} => |planet|" . $_[0] }'
js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }'
php: 'return $text . "{{planet}} => |planet|" . $text;'
python: 'lambda text: "%s{{planet}} => |planet|%s" % (text, text)'
template: "{{= | | =}}<|#lambda|-|/lambda|>"
expected: "<-{{planet}} => Earth->"

- name: Section - Multiple Calls - name: Section - Multiple Calls
desc: Lambdas used for sections should not be cached. desc: Lambdas used for sections should not be cached.
data: data:
Expand Down

0 comments on commit 6d8e60e

Please sign in to comment.