Sha256: a0913c56c4194718792f41616a8f770a5833b72708e5a7636ce469bcf5dc0114

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

# -*- encoding: utf-8 -*-

module ArtiMark
  module ListParser
    include BaseParser
 
    def accept?(lines)
      lex_line_command(lines[0])[:cmd] =~ @cmd
    end

    def parse(lines, r, syntax)
      lexed = lex_line_command(lines[0])
      r << "<#{@blockname}#{class_string(lexed[:cls])}>\n"
      process_block(lines, r, syntax)
      r << "</#{@blockname}>\n"
    end

    def process_block(lines, r, syntax)
      while lines.size > 0  
        lexed = lex_line_command(lines[0])
        return unless lexed[:cmd] =~ @cmd
        r << "<li>#{escape_html lexed[:text].strip}</li>\n"
        lines.shift
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arti_mark-0.0.1.beta3 lib/arti_mark/list_parser.rb
arti_mark-0.0.1.beta2 lib/arti_mark/list_parser.rb
arti_mark-0.0.1.beta1 lib/arti_mark/list_parser.rb
arti_mark-0.0.1.beta0 lib/arti_mark/list_parser.rb