Class: Rouge::Lexers::XML
- Inherits:
-
RegexLexer
- Object
- Rouge::Lexer
- RegexLexer
- Rouge::Lexers::XML
- Defined in:
- lib/rouge/lexers/xml.rb
Class Method Summary collapse
Methods inherited from RegexLexer
[], #get_state, get_state, #initialize, state, states, #step, #stream_tokens, #stream_with_state
Methods inherited from Rouge::Lexer
aliases, #debug, default_options, filenames, find, #get_tokens, guess, guess_by_filename, guess_by_mimetype, guess_by_source, #initialize, lex, #lex, make, mimetypes, new, #option, #options, register, #stream_tokens, tag
Constructor Details
This class inherits a constructor from Rouge::RegexLexer
Class Method Details
.analyze_text(text) ⇒ Object
14 15 16 17 18 |
# File 'lib/rouge/lexers/xml.rb', line 14 def self.analyze_text(text) return 0.5 if text.doctype? return 0.5 if text[0..1000] =~ %r(<.+?>.*?</.+?>)m return 0.8 if text =~ /\A<\?xml\b/ end |