mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
(ERB::Compiler): add instance variable @insert_cmd to change <%='s behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3428af761c
commit
b468b45f7a
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Jan 11 00:12:29 2006 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* lib/erb.rb (ERB::Compiler): add instance variable @insert_cmd to
|
||||||
|
change <%='s behavior.
|
||||||
|
|
||||||
Tue Jan 10 19:42:33 2006 Tanaka Akira <akr@m17n.org>
|
Tue Jan 10 19:42:33 2006 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* gc.c (garbage_collect): mark ruby_current_node.
|
* gc.c (garbage_collect): mark ruby_current_node.
|
||||||
|
|
|
@ -558,7 +558,7 @@ class ERB
|
||||||
out.push(content)
|
out.push(content)
|
||||||
end
|
end
|
||||||
when '<%='
|
when '<%='
|
||||||
out.push("#{@put_cmd}((#{content}).to_s)")
|
out.push("#{@insert_cmd}((#{content}).to_s)")
|
||||||
when '<%#'
|
when '<%#'
|
||||||
# out.push("# #{content.dump}")
|
# out.push("# #{content.dump}")
|
||||||
end
|
end
|
||||||
|
@ -607,11 +607,12 @@ class ERB
|
||||||
def initialize(trim_mode)
|
def initialize(trim_mode)
|
||||||
@percent, @trim_mode = prepare_trim_mode(trim_mode)
|
@percent, @trim_mode = prepare_trim_mode(trim_mode)
|
||||||
@put_cmd = 'print'
|
@put_cmd = 'print'
|
||||||
|
@insert_cmd = @put_cmd
|
||||||
@pre_cmd = []
|
@pre_cmd = []
|
||||||
@post_cmd = []
|
@post_cmd = []
|
||||||
end
|
end
|
||||||
attr_reader :percent, :trim_mode
|
attr_reader :percent, :trim_mode
|
||||||
attr_accessor :put_cmd, :pre_cmd, :post_cmd
|
attr_accessor :put_cmd, :insert_cmd, :pre_cmd, :post_cmd
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -705,6 +706,7 @@ class ERB
|
||||||
#
|
#
|
||||||
def set_eoutvar(compiler, eoutvar = '_erbout')
|
def set_eoutvar(compiler, eoutvar = '_erbout')
|
||||||
compiler.put_cmd = "#{eoutvar}.concat"
|
compiler.put_cmd = "#{eoutvar}.concat"
|
||||||
|
compiler.insert_cmd = "#{eoutvar}.concat"
|
||||||
|
|
||||||
cmd = []
|
cmd = []
|
||||||
cmd.push "#{eoutvar} = ''"
|
cmd.push "#{eoutvar} = ''"
|
||||||
|
@ -822,5 +824,3 @@ class ERB
|
||||||
module_function :def_erb_method
|
module_function :def_erb_method
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue