Project

General

Profile

Feature #3359 » coderay-r710.patch

Changes from r710 - Jan Losinski, 2009-08-13 22:08

View differences:

coderay/lib/coderay/encoders/html.rb 2009-08-13 20:46:53.419539186 +0200
25 25
  #
26 26
  # == Options
27 27
  #
28
  # === :escape
29
  # Escape html entities
30
  # Default: true
31
  #
28 32
  # === :tab_width
29 33
  # Convert \t characters to +n+ spaces (a number.)
30 34
  # Default: 8
......
86 90
    FILE_EXTENSION = 'html'
87 91

  
88 92
    DEFAULT_OPTIONS = {
93
      :escape => true,
89 94
      :tab_width => 8,
90 95

  
91 96
      # :level => :xhtml,  # reserved for future use
......
162 167
      @HTML_ESCAPE = HTML_ESCAPE.dup
163 168
      @HTML_ESCAPE["\t"] = ' ' * options[:tab_width]
164 169

  
170
      @escape = options[:escape]
165 171
      @opened = [nil]
166 172
      @css = CSS.new options[:style]
167 173

  
......
245 251
        # raise 'Token with nil as text was given: %p' % [[text, type]] 
246 252
      
247 253
      when String
248
        if text =~ /#{HTML_ESCAPE_PATTERN}/o
254
        if @escape && (text =~ /#{HTML_ESCAPE_PATTERN}/o)
249 255
          text = text.gsub(/#{HTML_ESCAPE_PATTERN}/o) { |m| @HTML_ESCAPE[m] }
250 256
        end
251 257
        @opened[0] = type
(2-2/4)