require 'coderay' require 'erb' include ERB::Util code = <<'CODE' $ie.text_field(:name, "pAnfrage ohne $gV und mit #{$gv}").set artikel oder text = $bla.test(...) CODE puts < HTML CodeRay.scan_stream code, :ruby do |text, kind| next if text.is_a? Symbol text = h(text) text = '%s' % text if kind == :global_variable print text end puts < HTML