Sha256: 0cb9de19da9dac00abfb5efaf01cf6105f138b98ed0577b6cc1f9bcf0fc49d4e

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

module Jekyll
  module Diagrams
    class PlantUMLBlock < Block
      def render_svg(code, config)
        command = build_command(config)

        svg = render_with_stdin_stdout(command, code)
        svg.sub!(/^<\?xml([^>]|\n)*>\n?/, '')
      end

      def build_command(config)
        options = 'java'
        options << ' -Djava.awt.headless=true'
        options << ' -jar '
        options << vendor_path('plantuml.1.2020.1.jar')
        options << ' -tsvg -pipe'
      end
    end
  end
end

Liquid::Template.register_tag(:plantuml, Jekyll::Diagrams::PlantUMLBlock)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-diagrams-0.9.1 lib/jekyll-diagrams/plantuml.rb
jekyll-diagrams-0.9.0 lib/jekyll-diagrams/plantuml.rb
jekyll-diagrams-0.8.0 lib/jekyll-diagrams/plantuml.rb