Class: PseudoHiki::BlockParser::BlockNode

Inherits:
BlockStack::Node
  • Object
show all
Defined in:
lib/pseudohiki/blockparser.rb

Direct Known Subclasses

NestedBlockNode, NonNestedBlockNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#node_idObject

Returns the value of attribute node_id.



129
130
131
# File 'lib/pseudohiki/blockparser.rb', line 129

def node_id
  @node_id
end

Instance Method Details

#add_leaf(line, blockparser) ⇒ Object



146
147
148
149
150
# File 'lib/pseudohiki/blockparser.rb', line 146

def add_leaf(line, blockparser)
  leaf = create_leaf(line, blockparser)
  blockparser.stack.pop while blockparser.breakable?(leaf)
  blockparser.stack.push leaf
end

#breakable?(breaker) ⇒ Boolean

Returns:

  • (Boolean)


140
141
142
# File 'lib/pseudohiki/blockparser.rb', line 140

def breakable?(breaker)
  not (kind_of? breaker.block and level == breaker.level)
end

#create_leaf(line, blockparser) ⇒ Object



152
153
154
155
156
# File 'lib/pseudohiki/blockparser.rb', line 152

def create_leaf(line, blockparser)
  return BlockElement::VerbatimLeaf.create("".freeze, true) if VERBATIM_BEGIN.match? line
  line = blockparser.auto_linker.link(line)
  blockparser.select_leaf_type(line).create(line)
end

#levelObject



131
132
133
# File 'lib/pseudohiki/blockparser.rb', line 131

def level
  first.level if first # @cached_level ||= (first.level if first)
end

#parse_leafsObject



144
# File 'lib/pseudohiki/blockparser.rb', line 144

def parse_leafs; end

#push_self(stack) ⇒ Object



135
136
137
138
# File 'lib/pseudohiki/blockparser.rb', line 135

def push_self(stack)
  @stack = stack
  super(stack)
end