From abbf5fa8ebef226d1ddc29b7bfaa954643d3b02d Mon Sep 17 00:00:00 2001 From: John Fairhurst Date: Sun, 13 Oct 2019 23:47:14 +0100 Subject: [PATCH] Ensure XML lexer handles unknown DOCTYPEs (#1348) The Mason lexer mistakenly handles unknown DOCTYPEs. This commit ensures that the XML lexer handles unknown DOCTYPEs and adds a test to prevent future regressions. --- lib/rouge/lexers/mason.rb | 5 ----- spec/lexers/xml_spec.rb | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/rouge/lexers/mason.rb b/lib/rouge/lexers/mason.rb index 7902e900da..06e9f9de0e 100644 --- a/lib/rouge/lexers/mason.rb +++ b/lib/rouge/lexers/mason.rb @@ -15,11 +15,6 @@ def initialize(*) @perl = Perl.new end - def self.detect?(text) - return false if text.doctype?(/((?:ht|x)ml)/) - return true if text.doctype? - end - # Note: If you add a tag in the lines below, you also need to modify "disambiguate '*.m'" in file disambiguation.rb TEXT_BLOCKS = %w(text doc) PERL_BLOCKS = %w(args flags attr init once shared perl cleanup filter) diff --git a/spec/lexers/xml_spec.rb b/spec/lexers/xml_spec.rb index cb26cfde84..4a328fdedb 100644 --- a/spec/lexers/xml_spec.rb +++ b/spec/lexers/xml_spec.rb @@ -34,6 +34,7 @@ assert_guess :source => '' assert_guess :source => '' deny_guess :source => '' + assert_guess :source => '' end end end