Sha256: 63613bb648e9d6f9153b161707d78600a8a11b042e4dd0d75baddb79375f2ba9
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
# frozen_string_literal: true module Jekyll module Diagrams class BlockdiagBlock < Block CONFIGURATIONS = %w[config font fontmap size].freeze SWITCHES = { 'antialias' => false }.freeze def render_svg(code, config) command = build_command(config) render_with_tempfile(command, code) do |input, output| "#{input} -o #{output}" end end def build_command(config) command = +"#{block_name} -T svg --nodoctype" SWITCHES.merge(config.slice(*SWITCHES.keys)).each do |switch, value| command << " --#{switch}" if value != false end CONFIGURATIONS.each do |conf| command << " --#{conf}=#{config[conf]}" if config.key?(conf) end command end end end end %i[blockdiag seqdiag actdiag nwdiag rackdiag packetdiag].each do |tag| Liquid::Template.register_tag(tag, Jekyll::Diagrams::BlockdiagBlock) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-diagrams-0.9.3 | lib/jekyll-diagrams/blockdiag.rb |