lib/rouge/lexers/xml.rb in rouge-2.2.1 vs lib/rouge/lexers/xml.rb in rouge-3.0.0

- old
+ new

@@ -13,15 +13,13 @@ image/svg+xml application/rss+xml application/atom+xml ) - 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 + def self.detect?(text) + return false if text.doctype?(/html/) + return true if text =~ /\A<\?xml\b/ + return true if text.doctype? end state :root do rule /[^<&]+/, Text rule /&\S*?;/, Name::Entity