class CodeRay::Encoders::HTML::Output::Template

:nodoc:

def self.wrap! str, template, target

def self.wrap! str, template, target
  target = Regexp.new(Regexp.escape("<%#{target}%>"))
  if template =~ target
    str[0,0] = $`
    str << $'
  else
    raise "Template target <%%%p%%> not found" % target
  end
end

def apply target, replacement

def apply target, replacement
  target = Regexp.new(Regexp.escape("<%#{target}%>"))
  if self =~ target
    Template.new($` + replacement + $')
  else
    raise "Template target <%%%p%%> not found" % target
  end
end