Module: Rouge::Guessers::Util::SourceNormalizer

Defined in:
lib/rouge/guessers/util.rb

Constant Summary collapse

UTF8_BOM =
"\xEF\xBB\xBF"
UTF8_BOM_RE =
/\A#{UTF8_BOM}/

Class Method Summary collapse

Class Method Details

.normalize(source) ⇒ String?

Parameters:

  • source (String, nil)

Returns:

  • (String, nil)


12
13
14
# File 'lib/rouge/guessers/util.rb', line 12

def self.normalize(source)
  source.sub(UTF8_BOM_RE, '').gsub(/\r\n/, "\n")
end