# File lib/slim/translator.rb, line 58 def initialize(opts = {}) super @translate = eval("proc {|string| #{options[:tr_fn]}(string) }") end
# File lib/slim/translator.rb, line 63 def call(exp) @text, @captures = '', [] result = compile(exp) text = @translate.call(@text) while text =~ /%(\d+)/ result << [:static, $`] << @captures[$1.to_i - 1] text = $' end result << [:static, text] end
# File lib/slim/translator.rb, line 80 def on_slim_output(escape, code, content) @captures << [:slim, :output, escape, code, content] @text << "%#{@captures.size}" [:multi] end
# File lib/slim/translator.rb, line 75 def on_static(text) @text << text [:multi] end