Class: Source2MD::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/source2md/element.rb

Constant Summary collapse

PLUGINS =
[
  Formatter::TypeHidden,       # #+hidden: true
  Formatter::TypeEval,          # #+eval:
  Formatter::TypeCodeInclude,  # #+code_include: path/to/foo.html xml:SAMPLE.xml
  Formatter::TypeRawInclude,   # #+raw_include: path/to/file.txt
  Formatter::TypeParseInclude, # #+parse_include: path/to/file.txt
  Formatter::TypeTitle,        # #+title2: foo
  Formatter::TypeWarn,         # #+warn: foo
  Formatter::TypeAlert,        # #+alert: foo
  Formatter::TypeMethod,       # #+name: foo
  Formatter::TypeTable,        # # |-
  Formatter::TypeSourceBlock,  # #+BEGIN_SRC
  Formatter::TypeText,         # # foo
  Formatter::TypePartialCode,  # 1 + 2 # => 3
  Formatter::TypeElse,
]

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Element

Returns a new instance of Element.



20
21
22
# File 'lib/source2md/element.rb', line 20

def initialize(content)
  @content = content
end

Instance Method Details

#bodyObject



34
35
36
# File 'lib/source2md/element.rb', line 34

def body
  @body ||= @content.remove(key_value_regexp).freeze
end

#headObject



30
31
32
# File 'lib/source2md/element.rb', line 30

def head
  @head ||= @content.scan(key_value_regexp).to_h.freeze
end

#to_mdObject



24
25
26
27
28
# File 'lib/source2md/element.rb', line 24

def to_md
  object = support_klass.new(self)
  debug_log(object)
  object.to_md
end