lib/jekyll-diagrams/vega.rb in jekyll-diagrams-0.9.3 vs lib/jekyll-diagrams/vega.rb in jekyll-diagrams-0.10.0
- old
+ new
@@ -1,33 +1,12 @@
# frozen_string_literal: true
+require_relative 'vega/renderer'
+require_relative 'vega/block'
+
module Jekyll
module Diagrams
- class VegaBlock < Block
- CONFIGURATIONS = %w[scale].freeze
-
- def render_svg(code, config)
- if block_name == 'vegalite'
- code = render_with_stdin_stdout('vl2vg', code)
- end
-
- command = build_command(config)
-
- render_with_stdin_stdout(command, code)
- end
-
- def build_command(config)
- command = +'vg2svg'
-
- CONFIGURATIONS.each do |conf|
- command << " --#{conf} #{config[conf]}" if config.key?(conf)
- end
-
- command
- end
+ %i[vega vegalite].each do |name|
+ Liquid::Template.register_tag(name, const_get("#{name.capitalize}Block"))
end
end
-end
-
-%i[vega vegalite].each do |tag|
- Liquid::Template.register_tag(tag, Jekyll::Diagrams::VegaBlock)
end