added xml comment support

This commit is contained in:
Eric Sherman 2011-03-30 22:15:41 -04:00
parent d495074320
commit 6c96fcb681

View File

@ -171,7 +171,7 @@ class Rocco
def detect_language def detect_language
@_language ||= @_language ||=
if pygmentize? if pygmentize?
%x[pygmentize -N #{@file}].strip! %x[pygmentize -N #{@file}].strip.split('+').first
else else
"text" "text"
end end
@ -247,6 +247,10 @@ class Rocco
:multi => { :start => '=begin', :middle => nil, :end => '=end' } :multi => { :start => '=begin', :middle => nil, :end => '=end' }
}, },
"scheme" => { :single => ";;", :multi => nil }, "scheme" => { :single => ";;", :multi => nil },
"xml" => {
:single => nil,
:multi => { :start => '<!--', :middle => nil, :end => '-->' }
},
} }
def generate_comment_chars def generate_comment_chars
@ -390,7 +394,7 @@ class Rocco
divider_output = Regexp.new( divider_output = Regexp.new(
[ "\\n*", [ "\\n*",
span, span,
Regexp.escape(front), Regexp.escape(CGI.escapeHTML(front)),
' DIVIDER', ' DIVIDER',
espan, espan,
"\\n*" "\\n*"
@ -402,11 +406,11 @@ class Rocco
divider_input = "\n\n#{front}\nDIVIDER\n#{back}\n\n" divider_input = "\n\n#{front}\nDIVIDER\n#{back}\n\n"
divider_output = Regexp.new( divider_output = Regexp.new(
[ "\\n*", [ "\\n*",
span, Regexp.escape(front), espan, span, Regexp.escape(CGI.escapeHTML(front)), espan,
"\\n", "\\n",
span, "DIVIDER", espan, span, "DIVIDER", espan,
"\\n", "\\n",
span, Regexp.escape(back), espan, span, Regexp.escape(CGI.escapeHTML(back)), espan,
"\\n*" "\\n*"
].join, Regexp::MULTILINE ].join, Regexp::MULTILINE
) )