Method: Markascend::Parser#parse_paragraph

Defined in:
lib/markascend/parser.rb

#parse_paragraphObject



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/markascend/parser.rb', line 167

def parse_paragraph
  @src.match?(/\ */)
  indent = @src.matched_size
  line, block = scan_line_and_block
  if line
    @out << :"<p>" if @top_level
    LineUnit.new(@env, line, block).parse(@out)

    # same indent and not matching rec/code blocks
    while (@src.match?(/\ */); @src.matched_size) == indent and !@src.match?(NON_PARA_START)
      line, block = scan_line_and_block
      break unless line
      LineUnit.new(@env, line, block).parse(@out)
    end
    # consume one more empty line if possible
    @src.scan /\ *\n/
    # delete back last <br>
    @out.pop if @out.last == :"<br>"
    @out << :"</p>" if @top_level
    true
  end
end