Verbatim and list multi-line parser implementation
This commit is contained in:
		@@ -66,11 +66,20 @@ module Skeksis
 | 
			
		||||
      data = input.map(&:chomp)
 | 
			
		||||
 | 
			
		||||
      in_verbatim_block = false
 | 
			
		||||
      in_multiline_block = false
 | 
			
		||||
      in_block = nil
 | 
			
		||||
      content = []
 | 
			
		||||
 | 
			
		||||
      data.each do |line|
 | 
			
		||||
        type = get_type(line)
 | 
			
		||||
 | 
			
		||||
        case type
 | 
			
		||||
        when :list
 | 
			
		||||
          if not in_verbatim_block
 | 
			
		||||
            in_multiline_block = true
 | 
			
		||||
            in_block = type
 | 
			
		||||
          end
 | 
			
		||||
          content.push(line)
 | 
			
		||||
        when :verbatim
 | 
			
		||||
          if in_verbatim_block == false
 | 
			
		||||
            in_verbatim_block = true
 | 
			
		||||
@@ -83,6 +92,13 @@ module Skeksis
 | 
			
		||||
            next
 | 
			
		||||
          end
 | 
			
		||||
        else
 | 
			
		||||
          if in_multiline_block == true
 | 
			
		||||
            #puts("in multiline block")
 | 
			
		||||
            list.push({ type: in_block, content: content })
 | 
			
		||||
            in_multiline_block = false
 | 
			
		||||
            content = []
 | 
			
		||||
          end
 | 
			
		||||
          
 | 
			
		||||
          if in_verbatim_block == true
 | 
			
		||||
            content.push(line)
 | 
			
		||||
          end
 | 
			
		||||
@@ -102,7 +118,8 @@ module Skeksis
 | 
			
		||||
        #  next
 | 
			
		||||
        #end
 | 
			
		||||
        
 | 
			
		||||
        if in_verbatim_block == false
 | 
			
		||||
        if in_verbatim_block == false and in_multiline_block == false
 | 
			
		||||
          #puts("catch-all push")
 | 
			
		||||
          list.push({ type: type, content: [line] })
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user