Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/temple/generators/erb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def on_dynamic(code)
def on_code(code)
"<% #{code} %>"
end

def on_newline
'' # prevent duplicating newlines!
end
end
end
end
1 change: 1 addition & 0 deletions test/test_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def on_code(s)
gen.call([:static, 'test']).should.equal 'test'
gen.call([:dynamic, 'test']).should.equal '<%= test %>'
gen.call([:code, 'test']).should.equal '<% test %>'
gen.call([:newline]).should.equal '' # erb is a template language (Avoid adding newlines)

gen.call([:multi, [:static, 'a'], [:static, 'b']]).should.equal 'ab'
gen.call([:multi, [:static, 'a'], [:dynamic, 'b']]).should.equal 'a<%= b %>'
Expand Down