Skip to content

Commit 86a0635

Browse files
authored
[erb] remove .strip from code in :code section (#23)
* Trying to fix do blcoks * stop stripping code in :code section
1 parent 7644501 commit 86a0635

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/ruby_ast_gen/erb_to_ruby_transformer.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ def visit(node)
7171
@output << "#{buffer_to_use} << \"#{@static_buff.join('\n').gsub(/(?<!\\)"/, '')}\""
7272
@static_buff = [] # clear static buffer
7373
end
74-
code = node[1].to_s.strip
74+
75+
stripped_code = node[1].to_s.strip
76+
code = node[1].to_s
7577
# Using this to determine if we should throw a StandardError for "invalid" ERB
76-
if is_control_struct_start(code)
78+
if is_control_struct_start(stripped_code)
7779
@in_control_block = true
78-
@output << code
80+
@output << stripped_code
7981
elsif code.start_with?("end")
8082
if @in_do_block
8183
@in_do_block = false

0 commit comments

Comments
 (0)