Skip to content

Commit

Permalink
Proposal to rtomayko#77
Browse files Browse the repository at this point in the history
  • Loading branch information
yumitsu committed Jan 10, 2012
1 parent 8bedee1 commit 13b7975
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rocco.rb
Expand Up @@ -170,10 +170,16 @@ def pygmentize?
# We'll also return `text` if `pygmentize` isn't available.
#
# We'll memoize the result, as we'll call this a few times.
require 'rocco/comment_styles'
include CommentStyles

def detect_language
ext = File.extname(@file).slice(1..-1)
@_language ||=
if pygmentize?
%x[pygmentize -N #{@file}].strip.split('+').first
elsif !COMMENT_STYLES[ext].nil?
ext
else
"text"
end
Expand Down Expand Up @@ -210,9 +216,6 @@ def detect_language
#
# At the moment, we're only returning `:single`. Consider this
# groundwork for block comment parsing.
require 'rocco/comment_styles'
include CommentStyles

def generate_comment_chars
@_commentchar ||=
if COMMENT_STYLES[@options[:language]]
Expand Down

0 comments on commit 13b7975

Please sign in to comment.