class Rugments::Lexers::XML

Public Class Methods

analyze_text(text) click to toggle source
# File lib/rugments/lexers/xml.rb, line 16
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{<.+?>.*?</.+?>}m
end