diff options
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r-- | lib/coderay/encoders/html/output.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index 3841f44..66ff0ba 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -17,6 +17,16 @@ module Encoders end.sub('<%CONTENT%>', string) end + 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 + SPAN = '<span class="CodeRay"><%CONTENT%></span>' DIV = <<-DIV |