Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Aug 30, 2016
1 parent 8c4a948 commit 1ee3955
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/jekyll-plantuml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ module Jekyll
class PlantumlBlock < Liquid::Block
def initialize(tag_name, markup, tokens)
super
@html = (markup or "").strip
@html = (markup or '').strip
end

def render(context)
site = context.registers[:site]
name = Digest::MD5.hexdigest(super)
if !File.exists?(File.join(site.dest, "uml/#{name}.svg"))
file = File.join(site.dest, "uml/#{name}.svg")
if !File.exists?(file)
uml = File.join(site.source, "uml/#{name}.uml")
FileUtils.mkdir_p(File.dirname(uml))
File.open(uml, 'w') { |f|
Expand All @@ -45,6 +46,7 @@ def render(context)
site.static_files << Jekyll::StaticFile.new(
site, site.source, 'uml', "#{name}.svg"
)
puts "File #{file} created (#{File.size(file)} bytes)"
end
"<p><img src='/uml/#{name}.svg' #{@html}
alt='PlantUML diagram' class='plantuml'/></p>"
Expand Down

0 comments on commit 1ee3955

Please sign in to comment.