mdc/lib/parsing/parser_handler.rb
##
# Handling of line elements, i.e. elements that occupy only a single
# line in the markdown file
# @param [ParserState] ps State of the parser
# @param [MarkdownLine] line Line of input
Handling of line elements, i.e. elements that occupy only a single
line in the markdown file
Handling of line elements i . e . elements that occupy only a single line in the markdown file
def inline(ps, line)
      e = LineMatcher.match(line.string, ps.line_id)
      if slide(ps).nil? && !line.empty?
        raise Exception, "Line #{ps.line_counter} of file '#{ps.file_name}' " \
                         'contains content outside of a subsection. Maybe you ' \
                         "forgot to start the subsection with '## TITLE'? " \
                         "#{ps}, '#{line}'"
      end
      if e.nil?
        if line.normal?
          slide(ps) << Domain::Text.new(line.string) if line.text?
          ps.normal!
        elsif line.empty?
          return if ps.ul1? || ps.ul2?
          ps.normal!
        else
          raise Exception, "Line #{ps.line_counter} of file '#{ps.file_name}' " \
                           "has a syntax error - #{ps}, '#{line}'"
        end
      else
        if e.instance_of?(Domain::Footnote)
          ps.chapter.add_footnote(e)
        elsif e.instance_of?(Domain::Link)
          ps.chapter.add_link(e)
        else
          slide(ps) << e
        end
        if e.instance_of?(Domain::Image) && !@test_mode
          e.formats = get_extensions(e.location)
          e.license = get_license(e.location)
        end
      end
    end
def inline ( ps , line ) e = LineMatcher . match ( line . string , ps . line_id ) if slide ( ps ) . nil? && ! line . empty? raise Exception , "Line #{ps.line_counter} of file '#{ps.file_name}' " 'contains content outside of a subsection. Maybe you ' "forgot to start the subsection with '## TITLE'? " "#{ps}, '#{line}'" end if e . nil? if line . normal? slide ( ps ) << Domain :: Text . new ( line . string ) if line . text? ps . normal! elsif line . empty? return if ps . ul1? || ps . ul2? ps . normal! else raise Exception , "Line #{ps.line_counter} of file '#{ps.file_name}' " "has a syntax error - #{ps}, '#{line}'" end else if e . instance_of? ( Domain :: Footnote ) ps . chapter . add_footnote ( e ) elsif e . instance_of? ( Domain :: Link ) ps . chapter . add_link ( e ) else slide ( ps ) << e end if e . instance_of? ( Domain :: Image ) && ! @test_mode e . formats = get_extensions ( e . location ) e . license = get_license ( e . location ) end end end
Handling of line elements, i.e.
Handling of line elements i . e .
# Catch malformed documents with missing sections # This is the footnote text, not the reference in the text # This is a reference style link, not the reference in ths text # for image, read available extensions
ps
<not_specific>
line
<not_specific>
<not_specific>
line Line of input
line Line of input