Skip to content

Commit

Permalink
#47 body
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 6, 2024
1 parent 1ea9b19 commit 24efe51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/jekyll-plantuml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def initialize(tag_name, markup, tokens)

def render(context)
site = context.registers[:site]
name = Digest::MD5.hexdigest(super)
body = super.to_s
name = Digest::MD5.hexdigest(body)
unless File.exist?(File.join(site.dest, "uml/#{name}.svg"))
uml = File.join(site.source, "uml/#{name}.uml")
svg = File.join(site.source, "uml/#{name}.svg")
Expand All @@ -48,10 +49,10 @@ def render(context)
FileUtils.mkdir_p(File.dirname(uml))
File.open(uml, 'w') do |f|
f.write("@startuml\n")
f.write(super)
f.write(body)
f.write("\n@enduml")
end
system("plantuml -tsvg #{uml}") or raise "PlantUML error: #{super}"
system("plantuml -tsvg #{uml}") or raise "PlantUML error: #{body}"
site.static_files << Jekyll::StaticFile.new(
site, site.source, 'uml', "#{name}.svg"
)
Expand Down

0 comments on commit 24efe51

Please sign in to comment.