Sha256: 9186cc1398a10397628be548365c2aabddbee741aa1adbc619d8dcbd16ae20a8

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'singleton'

module ArtiMark
  class ParagraphParser
    include BaseParser, Singleton

    def accept?(lines)
      lines[0].size == 0
    end
    def parse(lines, context, syntax)
        lines.shift while lines[0].size == 0
        return unless syntax.determine_parser(lines).nil? 
        context << process_paragraph_group(lines, '', syntax, context)
    end

    def process_paragraph_group(lines, paragraph, syntax, context)
      paragraph << "<div class='pgroup'>\n" if context.enable_pgroup
      while (lines.size > 0 && 
            lines[0] != '}' && # TODO: is this correct...?
            syntax.determine_parser(lines).nil?)
          paragraph << process_line(lines.shift, syntax, context) 
      end
      paragraph << "</div>\n" if context.enable_pgroup
      paragraph
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arti_mark-0.0.1.beta1 lib/arti_mark/paragraph_parser.rb
arti_mark-0.0.1.beta0 lib/arti_mark/paragraph_parser.rb