Parent

Methods

Jekyll::PlantUMLBlock

Attributes

config[R]

Public Instance Methods

render(context) click to toggle source
# File doc/plugins/plantuml.rb, line 19
def render(context)
  site = context.registers[:site]
  self.config = site.config['plantuml']

  tmproot = File.expand_path(tmp_folder)
  folder = '/images/plantuml/'
  create_tmp_folder(tmproot, folder)

  code = @nodelist.join + background_color
  filename = Digest::MD5.hexdigest(code) + '.png'
  filepath = tmproot + folder + filename
  if !File.exist?(filepath)
    plantuml_jar = File.expand_path(plantuml_jar_path)
    cmd = 'java -Djava.awt.headless=true -jar ' + plantuml_jar + dot_cmd + ' -pipe > ' + filepath
    result, status = Open3.capture2e(cmd, :stdin_data=>code)
    Jekyll.logger.debug(filepath + " -->\t" + status.inspect() + "\t" + result)
  end

  site.static_files << Jekyll::StaticFile.new(site, tmproot, folder, filename)

  "<img src='" + "#{ site.baseurl }/" + folder + filename + "'>"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.