Sha256: f49fd331d1b3c48c5bcb4a44c2803c3e7c8a5d2778f27d83e6755dea506c64c6

Contents?: true

Size: 602 Bytes

Versions: 2

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

module Jekyll
  module Diagrams
    class SvgbobBlock < Block
      CONFIGURATIONS = %w[font-family font-size scale stroke-width].freeze

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

        render_with_stdin_stdout(command, code)
      end

      def build_command(config)
        command = +'svgbob'

        CONFIGURATIONS.each do |conf|
          command << " --#{conf} #{config[conf]}" if config.key?(conf)
        end

        command
      end
    end
  end
end

Liquid::Template.register_tag(:svgbob, Jekyll::Diagrams::SvgbobBlock)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-diagrams-0.9.3 lib/jekyll-diagrams/svgbob.rb
jekyll-diagrams-0.9.2 lib/jekyll-diagrams/svgbob.rb