class Markdownplus::CodeBlock

Attributes

directive[R]
output[RW]
program[R]

Public Class Methods

new(block_number, value=nil) click to toggle source
# File lib/markdownplus/parser.rb, line 148
def initialize(block_number, value=nil)
  @block_number = block_number
  @directive = value

  if @directive.match(/\(/)
    begin
      @program ||= Markdownplus::DirectiveParser.parse(@directive)
    rescue => e
      errors << e.message
    end
  end
end

Public Instance Methods

executable?() click to toggle source
# File lib/markdownplus/parser.rb, line 165
def executable?
  (functions!=nil && functions.size>0)
end
execute(variables) click to toggle source
# File lib/markdownplus/parser.rb, line 169
def execute(variables)
  self.output = self.input
  if functions
    self.functions.each do |function|
      self.output = function.execute(self.output, variables, self.warnings, self.errors)
    end
  end
  self.output
end
functions() click to toggle source
# File lib/markdownplus/parser.rb, line 161
def functions
  program.functions if program!=nil
end
input_markdown() click to toggle source
# File lib/markdownplus/parser.rb, line 179
def input_markdown
  s = input
  if s.end_with?("\n")
    result = "```#{directive}\n#{input}```\n"
  else
    result = "```#{directive}\n#{input}\n```\n"
  end
end
output_lines() click to toggle source
# File lib/markdownplus/parser.rb, line 192
def output_lines
  self.output.split("\n") if self.output
end
output_markdown() click to toggle source
# File lib/markdownplus/parser.rb, line 188
def output_markdown
  self.output
end