class Rouge::Lexers::XML

Public Class Methods

analyze_text(text) click to toggle source
# File lib/rouge/lexers/xml.rb, line 17
def self.analyze_text(text)
  return 0.9 if text.doctype?
  return 0.8 if text =~ /\A<\?xml\b/
  start = text[0..1000]
  return 0.6 if start =~ %r(<xml\b)
  return 0.3 if start =~ %r(<.+?>.*?</.+?>)
end