Class: NoraMark::HeadedSection
- Defined in:
- lib/nora_mark/node.rb,
lib/nora_mark/parser.kpeg.rb
Instance Attribute Summary collapse
-
#heading ⇒ Object
readonly
Returns the value of attribute heading.
-
#level ⇒ Object
Returns the value of attribute level.
-
#line_no ⇒ Object
readonly
Returns the value of attribute line_no.
-
#named_params ⇒ Object
readonly
Returns the value of attribute named_params.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#raw_content ⇒ Object
readonly
Returns the value of attribute raw_content.
Attributes inherited from Node
#attrs, #body_empty, #classes, #content, #first_child, #holders, #ids, #last_child, #name, #next, #no_tag, #parent, #prev, #raw_text
Instance Method Summary collapse
-
#initialize(level, heading, params, named_params, raw_content, line_no) ⇒ HeadedSection
constructor
A new instance of HeadedSection.
- #reparent ⇒ Object
- #text ⇒ Object
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, #replace, #unlink, #wrap
Constructor Details
#initialize(level, heading, params, named_params, raw_content, line_no) ⇒ HeadedSection
Returns a new instance of HeadedSection.
94 95 96 97 98 99 100 101 |
# File 'lib/nora_mark/parser.kpeg.rb', line 94 def initialize(level, heading, params, named_params, raw_content, line_no) @level = level @heading = heading @params = params @named_params = named_params @raw_content = raw_content @line_no = line_no end |
Instance Attribute Details
#heading ⇒ Object (readonly)
Returns the value of attribute heading.
103 104 105 |
# File 'lib/nora_mark/parser.kpeg.rb', line 103 def heading @heading end |
#level ⇒ Object
Returns the value of attribute level.
354 355 356 |
# File 'lib/nora_mark/node.rb', line 354 def level @level end |
#line_no ⇒ Object (readonly)
Returns the value of attribute line_no.
107 108 109 |
# File 'lib/nora_mark/parser.kpeg.rb', line 107 def line_no @line_no end |
#named_params ⇒ Object (readonly)
Returns the value of attribute named_params.
105 106 107 |
# File 'lib/nora_mark/parser.kpeg.rb', line 105 def named_params @named_params end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
104 105 106 |
# File 'lib/nora_mark/parser.kpeg.rb', line 104 def params @params end |
#raw_content ⇒ Object (readonly)
Returns the value of attribute raw_content.
106 107 108 |
# File 'lib/nora_mark/parser.kpeg.rb', line 106 def raw_content @raw_content end |
Instance Method Details
#reparent ⇒ Object
356 357 358 359 360 361 362 363 364 365 |
# File 'lib/nora_mark/node.rb', line 356 def reparent super @heading.inject(nil) do |prev, child_node| child_node.prev = prev prev.next = child_node if !prev.nil? child_node.parent = self child_node.reparent child_node end end |
#text ⇒ Object
367 368 369 370 371 |
# File 'lib/nora_mark/node.rb', line 367 def text @heading[0].inject('') do |result, node| result << node.text end << super end |