Merging in XML, extending to HTML.
This commit is contained in:
commit
b0582c9deb
18
lib/rocco.rb
18
lib/rocco.rb
@ -171,7 +171,7 @@ class Rocco
|
||||
def detect_language
|
||||
@_language ||=
|
||||
if pygmentize?
|
||||
%x[pygmentize -N #{@file}].strip!
|
||||
%x[pygmentize -N #{@file}].strip.split('+').first
|
||||
else
|
||||
"text"
|
||||
end
|
||||
@ -235,6 +235,11 @@ class Rocco
|
||||
:multi => { :start => "/**", :middle => "*", :end => "*/" },
|
||||
:heredoc => nil
|
||||
},
|
||||
"html" => {
|
||||
:single => nil,
|
||||
:multi => { :start => '<!--', :middle => nil, :end => '-->' },
|
||||
:heredoc => nil
|
||||
},
|
||||
"java" => {
|
||||
:single => "//",
|
||||
:multi => { :start => "/**", :middle => "*", :end => "*/" },
|
||||
@ -261,6 +266,11 @@ class Rocco
|
||||
:heredoc => "<<-"
|
||||
},
|
||||
"scheme" => { :single => ";;", :multi => nil, :heredoc => nil },
|
||||
"xml" => {
|
||||
:single => nil,
|
||||
:multi => { :start => '<!--', :middle => nil, :end => '-->' },
|
||||
:heredoc => nil
|
||||
},
|
||||
}
|
||||
|
||||
def generate_comment_chars
|
||||
@ -419,7 +429,7 @@ class Rocco
|
||||
divider_output = Regexp.new(
|
||||
[ "\\n*",
|
||||
span,
|
||||
Regexp.escape(front),
|
||||
Regexp.escape(CGI.escapeHTML(front)),
|
||||
' DIVIDER',
|
||||
espan,
|
||||
"\\n*"
|
||||
@ -431,11 +441,11 @@ class Rocco
|
||||
divider_input = "\n\n#{front}\nDIVIDER\n#{back}\n\n"
|
||||
divider_output = Regexp.new(
|
||||
[ "\\n*",
|
||||
span, Regexp.escape(front), espan,
|
||||
span, Regexp.escape(CGI.escapeHTML(front)), espan,
|
||||
"\\n",
|
||||
span, "DIVIDER", espan,
|
||||
"\\n",
|
||||
span, Regexp.escape(back), espan,
|
||||
span, Regexp.escape(CGI.escapeHTML(back)), espan,
|
||||
"\\n*"
|
||||
].join, Regexp::MULTILINE
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user