Sha256: a04b6e4b428e14ba11a0dc4b9a63b30ba6f44d51aa8b139753ac36b101425a08
Contents?: true
Size: 746 Bytes
Versions: 1
Compression:
Stored size: 746 Bytes
Contents
# frozen_string_literal: true module Jekyll module Diagrams class SMCatBlock < Block XML_REGEX = /^<\?xml(([^>]|\n)*>\n?){2}/.freeze CONFIGURATIONS = %w[direction engine input-type].freeze def render_svg(code, config) command = build_command(config) svg = render_with_tempfile(command, code, stdout: true) do |input| "#{input} --output-to -" end svg.sub!(XML_REGEX, '') end def build_command(config) command = +'smcat' CONFIGURATIONS.each do |conf| command << " --#{conf} #{config[conf]}" if config.key?(conf) end command end end end end Liquid::Template.register_tag(:smcat, Jekyll::Diagrams::SMCatBlock)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-diagrams-0.9.2 | lib/jekyll-diagrams/smcat.rb |