Class: AsciidoctorVaped::Parser::Blocks::DelimitedNode

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

Direct Known Subclasses

Example, Listing, Literal, Open, Passthrough, Quote, Sidebar, Table

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

#attributes(context) ⇒ Object



23
24
25
26
27
# File 'lib/asciidoctor_vaped/parser/blocks/delimited/delimited_node.rb', line 23

def attributes(context)
  return {} unless admonition?(context)

  { name: context.pending_attributes[:style].to_s.upcase }
end

#context_name(context) ⇒ Object



29
30
31
# File 'lib/asciidoctor_vaped/parser/blocks/delimited/delimited_node.rb', line 29

def context_name(context)
  admonition?(context) ? :admonition : default_context_name
end

#delimitersObject



19
20
21
# File 'lib/asciidoctor_vaped/parser/blocks/delimited/delimited_node.rb', line 19

def delimiters
  [delimiter]
end

#match?(context) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/asciidoctor_vaped/parser/blocks/delimited/delimited_node.rb', line 9

def match?(context)
  delimiters.include?(context.reader.peek)
end

#parse(context) ⇒ Object



13
14
15
16
17
# File 'lib/asciidoctor_vaped/parser/blocks/delimited/delimited_node.rb', line 13

def parse(context)
  lines = context.reader.read_delimited(context.reader.peek)
  node = build_node(context, lines)
  context.append node
end