diff options
author | murphy <murphy@rubychan.de> | 2010-03-26 03:04:29 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-03-26 03:04:29 +0000 |
commit | 4023cce129f7747bef304a513ca52dddc0633d19 (patch) | |
tree | 32b92a916e45d4a03bb6c0d696da05095383fd39 | |
parent | 971e6861621518e49687e2521552067838401720 (diff) | |
download | coderay-4023cce129f7747bef304a513ca52dddc0633d19.tar.gz |
Cleanup of Nitro-XHTML Scanner.
-rw-r--r-- | lib/coderay/scanners/nitro_xhtml.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/coderay/scanners/nitro_xhtml.rb b/lib/coderay/scanners/nitro_xhtml.rb index 6eb1d3b..fe6b303 100644 --- a/lib/coderay/scanners/nitro_xhtml.rb +++ b/lib/coderay/scanners/nitro_xhtml.rb @@ -5,13 +5,15 @@ module Scanners load :ruby # Nitro XHTML Scanner + # + # Alias: +nitro+ class NitroXHTML < Scanner include Streamable register_for :nitro_xhtml file_extension :xhtml title 'Nitro XHTML' - + KINDS_NOT_LOC = HTML::KINDS_NOT_LOC NITRO_RUBY_BLOCK = / @@ -35,7 +37,7 @@ module Scanners (?> %(?!>) [^%]* )* ) (?: %> )? - /mx + /mx # :nodoc: NITRO_VALUE_BLOCK = / \# @@ -52,28 +54,27 @@ module Scanners | \[ [^\]]* \]? | \\ [^\\]* \\? ) - /x + /x # :nodoc: NITRO_ENTITY = / % (?: \#\d+ | \w+ ) ; - / + / # :nodoc: START_OF_RUBY = / (?=[<\#%]) < (?: \?r | % | ruby> ) | \# [{(|] | % (?: \#\d+ | \w+ ) ; - /x + /x # :nodoc: - CLOSING_PAREN = Hash.new do |h, p| - h[p] = p - end.update( { + CLOSING_PAREN = Hash.new { |h, p| h[p] = p } # :nodoc: + CLOSING_PAREN.update( { '(' => ')', '[' => ']', '{' => '}', } ) - private + protected def setup @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true |