class PseudoHiki::BlockParser::BlockLeaf

Attributes

head_re[RW]
level[RW]
node_id[RW]

Public Class Methods

create(line, inline_parser=InlineParser) click to toggle source
# File lib/pseudohiki/blockparser.rb, line 59
def self.create(line, inline_parser=InlineParser)
  line = line.sub(head_re, "".freeze) if head_re
  new.concat(inline_parser.parse(line)) # leaf = self.new
end
with_depth?() click to toggle source
# File lib/pseudohiki/blockparser.rb, line 55
def self.with_depth?
  false
end

Public Instance Methods

block() click to toggle source
# File lib/pseudohiki/blockparser.rb, line 68
def block
  @parent_node ||= PARENT_NODE[self.class]
end
head_re() click to toggle source
# File lib/pseudohiki/blockparser.rb, line 64
def head_re
  @head_re ||= self.class.head_re
end
parse_leafs() click to toggle source
# File lib/pseudohiki/blockparser.rb, line 85
def parse_leafs
  parsed = InlineParser.parse(join)
  clear
  concat(parsed)
end
push_block(stack) click to toggle source
# File lib/pseudohiki/blockparser.rb, line 72
def push_block(stack)
  stack.push(block.new)
end
push_self(stack) click to toggle source
Calls superclass method
# File lib/pseudohiki/blockparser.rb, line 80
def push_self(stack)
  push_block(stack) unless under_appropriate_block?(stack)
  super(stack)
end
under_appropriate_block?(stack) click to toggle source
# File lib/pseudohiki/blockparser.rb, line 76
def under_appropriate_block?(stack)
  stack.current_node.kind_of? block and stack.current_node.level == level
end