Sha256: f458e641c8b463b48b543fd2718a6ccc231a17fbbd473e70127bf73d1cb8754b

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

module Jekyll
  module Diagrams
    class PlantUMLBlock < Block
      XML_REGEX = /^<\?xml([^>]|\n)*>\n?/.freeze

      def render_svg(code, config)
        command = build_command(config)

        svg = render_with_stdin_stdout(command, code)
        svg.sub!(XML_REGEX, '')
      end

      def build_command(_config)
        jar = Diagrams.vendor_path('plantuml.1.2020.1.jar')

        options = +Diagrams.run_jar(jar)
        options << ' -tsvg -pipe'
      end
    end
  end
end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-diagrams-0.9.3 lib/jekyll-diagrams/plantuml.rb