diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-19 03:09:35 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-19 03:09:35 +0200 |
commit | 75bc5455af8c3c3381066aac3d5fff42264cac6f (patch) | |
tree | 589d2c912ddd94c517eb794bcdf3257f8348f3c0 /lib/coderay/scanners/ruby.rb | |
parent | fdd17b6a09efb275238a3baef275465d31452f2a (diff) | |
download | coderay-75bc5455af8c3c3381066aac3d5fff42264cac6f.tar.gz |
Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests
Diffstat (limited to 'lib/coderay/scanners/ruby.rb')
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index e1395ca..25da208 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -26,7 +26,7 @@ module Scanners state, heredocs = @state heredocs = heredocs.dup if heredocs.is_a?(Array) - if state && state.instance_of?(self.class::StringState) + if state && state.instance_of?(StringState) encoder.begin_group state.type end @@ -426,13 +426,18 @@ module Scanners end # cleaning up - if options[:keep_state] - heredocs = nil if heredocs && heredocs.empty? - @state = state, heredocs + if state.is_a? StringState + encoder.end_group state.type end - if state.is_a? self.class::StringState - encoder.end_group state.type + if options[:keep_state] + if state.is_a?(StringState) && state.heredoc + (heredocs ||= []).unshift state + state = :initial + elsif heredocs && heredocs.empty? + heredocs = nil + end + @state = state, heredocs end if inline_block_stack |