Class: AsciidoctorVaped::Parser::Blocks::ListBase

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/asciidoctor_vaped/parser/blocks/lists/list_base.rb

Direct Known Subclasses

OrderedList, UnorderedList

Instance Method Summary collapse

Methods inherited from BaseNode

#handle, #initialize

Constructor Details

This class inherits a constructor from AsciidoctorVaped::Parser::Blocks::BaseNode

Instance Method Details

#match?(context) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/asciidoctor_vaped/parser/blocks/lists/list_base.rb', line 10

def match?(context)
  context.reader.peek&.match?(pattern)
end

#parse(context) ⇒ Object



14
15
16
17
18
19
# File 'lib/asciidoctor_vaped/parser/blocks/lists/list_base.rb', line 14

def parse(context)
  list = AST::Element.new(list_context)
  item_context = context.nested(list)
  item_chain.handle(item_context) while match?(context)
  context.append(list)
end