Feature #3359 » coderay-r710.patch
| coderay/lib/coderay/encoders/html.rb 2009-08-13 20:46:53.419539186 +0200 | ||
|---|---|---|
|
#
|
||
|
# == Options
|
||
|
#
|
||
|
# === :escape
|
||
|
# Escape html entities
|
||
|
# Default: true
|
||
|
#
|
||
|
# === :tab_width
|
||
|
# Convert \t characters to +n+ spaces (a number.)
|
||
|
# Default: 8
|
||
| ... | ... | |
|
FILE_EXTENSION = 'html'
|
||
|
DEFAULT_OPTIONS = {
|
||
|
:escape => true,
|
||
|
:tab_width => 8,
|
||
|
# :level => :xhtml, # reserved for future use
|
||
| ... | ... | |
|
@HTML_ESCAPE = HTML_ESCAPE.dup
|
||
|
@HTML_ESCAPE["\t"] = ' ' * options[:tab_width]
|
||
|
@escape = options[:escape]
|
||
|
@opened = [nil]
|
||
|
@css = CSS.new options[:style]
|
||
| ... | ... | |
|
# raise 'Token with nil as text was given: %p' % [[text, type]]
|
||
|
|
||
|
when String
|
||
|
if text =~ /#{HTML_ESCAPE_PATTERN}/o
|
||
|
if @escape && (text =~ /#{HTML_ESCAPE_PATTERN}/o)
|
||
|
text = text.gsub(/#{HTML_ESCAPE_PATTERN}/o) { |m| @HTML_ESCAPE[m] }
|
||
|
end
|
||
|
@opened[0] = type
|
||