Class: OrgParse::BlockNode

Inherits:
Node
  • Object
show all
Defined in:
lib/org-parse/node.rb

Overview

BLOCK の情報を保持

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #kind, #parent, #value

Instance Method Summary collapse

Methods inherited from Node

#done, #done?, #example?, #html?, #inspect, #is_leaf?, #section_no_array, #set_example, #set_html, #set_src, #set_to_descendant, #set_verse, #src?, #verse?

Constructor Details

#initialize(vals, children) ⇒ BlockNode

Returns a new instance of BlockNode.



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/org-parse/node.rb', line 238

def initialize(vals, children)
  @block_name = vals[0].upcase
  @indent = vals[2]
  @syntax = ''
  @syntax_theme = ''
  super(:BLOCK, children, vals[1])
  case @block_name
  when 'VERSE'
    set_to_descendant :set_verse
  when 'EXAMPLE'
    set_to_descendant :set_example
  when 'SRC'
    set_to_descendant :set_src
    if vals[1] =~ /SRC\s*([^\s]+)\s+([^\s]+)\s*$/i
      @syntax = $1.downcase
      @syntax_theme = $2.downcase
    elsif vals[1] =~ /SRC\s*(.+)\s*$/i
      @syntax = $1.downcase
    end
  when 'HTML'
    set_to_descendant :set_html
  end
end

Instance Attribute Details

#block_nameObject (readonly)

Returns the value of attribute block_name.



237
238
239
# File 'lib/org-parse/node.rb', line 237

def block_name
  @block_name
end

#indentObject (readonly)

Returns the value of attribute indent.



237
238
239
# File 'lib/org-parse/node.rb', line 237

def indent
  @indent
end

#syntaxObject (readonly)

Returns the value of attribute syntax.



237
238
239
# File 'lib/org-parse/node.rb', line 237

def syntax
  @syntax
end

#syntax_themeObject (readonly)

Returns the value of attribute syntax_theme.



237
238
239
# File 'lib/org-parse/node.rb', line 237

def syntax_theme
  @syntax_theme
end

Instance Method Details

#lineObject



262
263
264
# File 'lib/org-parse/node.rb', line 262

def line
  @value
end