lib/rouge/lexers/html.rb in rouge_ecl-0.0.1 vs lib/rouge/lexers/html.rb in rouge_ecl-1.0.0

- old
+ new

@@ -7,13 +7,13 @@ desc "HTML, the markup language of the web" tag 'html' filenames '*.htm', '*.html', '*.xhtml' mimetypes 'text/html', 'application/xhtml+xml' - def self.detect?(text) - return true if text.doctype?(/\bhtml\b/i) - return true if text =~ /<\s*html\b/ + def self.analyze_text(text) + return 1 if text.doctype?(/\bhtml\b/i) + return 1 if text =~ /<\s*html\b/ end start do @javascript = Javascript.new(options) @css = CSS.new(options) @@ -35,11 +35,10 @@ end rule /<\s*style\s*/m do token Name::Tag @css.reset! - @lang = @css push :style_content push :tag end rule /<\//, Name::Tag, :tag_end @@ -123,16 +122,16 @@ end end state :style_content do rule /[^<]+/ do - delegate @lang + delegate @css end rule %r(<\s*/\s*style\s*>)m, Name::Tag, :pop! rule /</ do - delegate @lang + delegate @css end end end end end