Class: NoraMark::Block

Inherits:
Node
  • Object
show all
Defined in:
lib/nora_mark/node.rb,
lib/nora_mark/parser.kpeg.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#attrs, #body_empty, #content, #first_child, #holders, #last_child, #next, #no_tag, #parent, #prev, #raw_text

Instance Method Summary collapse

Methods inherited from Node

#_find_node, #_match?, #_remove_internal, #add_attr, #after, #all_nodes, #ancestors, #append_child, #before, #build_selector, #children, #children=, #children_empty?, #children_replaced, #clone, #each, #find_node, #match?, #modify_selector, #named_params=, #params=, #prepend_child, #raw_text?, #rebuild_children, #remove, #remove_following, #reparent, #replace, #text, #unlink, #wrap

Constructor Details

#initialize(name, ids, classes, params, named_params, raw_content, line_no) ⇒ Block

Returns a new instance of Block.



14
15
16
17
18
19
20
21
22
# File 'lib/nora_mark/parser.kpeg.rb', line 14

def initialize(name, ids, classes, params, named_params, raw_content, line_no)
  @name = name
  @ids = ids
  @classes = classes
  @params = params
  @named_params = named_params
  @raw_content = raw_content
  @line_no = line_no
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



25
26
27
# File 'lib/nora_mark/parser.kpeg.rb', line 25

def classes
  @classes
end

#idsObject (readonly)

Returns the value of attribute ids.



24
25
26
# File 'lib/nora_mark/parser.kpeg.rb', line 24

def ids
  @ids
end

#line_noObject (readonly)

Returns the value of attribute line_no.



29
30
31
# File 'lib/nora_mark/parser.kpeg.rb', line 29

def line_no
  @line_no
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/nora_mark/parser.kpeg.rb', line 23

def name
  @name
end

#named_paramsObject (readonly)

Returns the value of attribute named_params.



27
28
29
# File 'lib/nora_mark/parser.kpeg.rb', line 27

def named_params
  @named_params
end

#paramsObject (readonly)

Returns the value of attribute params.



26
27
28
# File 'lib/nora_mark/parser.kpeg.rb', line 26

def params
  @params
end

#raw_contentObject (readonly)

Returns the value of attribute raw_content.



28
29
30
# File 'lib/nora_mark/parser.kpeg.rb', line 28

def raw_content
  @raw_content
end

Instance Method Details

#heading_infoObject



345
346
347
348
349
350
# File 'lib/nora_mark/node.rb', line 345

def heading_info
  @name =~ /h([1-6])/
  return {} if $1.nil?

  { level: $1.to_i, id: @ids[0], text: text }
end