jekyll-diagrams 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d32c6cbcbb135c9087be7ee389675976e51cb3fe
4
- data.tar.gz: 23d4b88d30a31fb44c74174bef69546bd863ca41
3
+ metadata.gz: 4c6675b0ac520e97b2996c72923471a10a1ccfd0
4
+ data.tar.gz: 762740eac4ecc614179150a95b390b6ff2bf4067
5
5
  SHA512:
6
- metadata.gz: 0eca0145e75bca62df25765e2c7db2045665dd83dd6787ed931d604c69ceee70bd35968820b4328fd1e65bbd1e47fccfd22e37509d784c9fc263c251348259a1
7
- data.tar.gz: 1acbbc864c870110b33a7cfbd07f83d9c6d63328d5361035618ceb62b5b90e21ed8bbf4add7cceca0123a6ccad9dd3d35643fd8a5df253e798417d97958b6ed8
6
+ metadata.gz: 6621464da76326d77e99ddb3601ade0da273295b5d66cfc87b85d48582ea1c5c2c028e5c1514aff2c0ecc6e43f0d36c7d6e61d6e33e171cfe351514d39912db8
7
+ data.tar.gz: 66c1a1f58cbd1ad98f876ff0b9d2c274e85082371c5944969d10e309481c2c5d25cd901accb1ac16d9e1a45e89216d5f3279805617e5c4ba13c59c63fa195fc7
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Jekyll Diagrams
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll-diagrams.svg)](https://badge.fury.io/rb/jekyll-diagrams)
3
4
  [![Build Status](https://travis-ci.org/farkasity/jekyll-diagrams.svg?branch=master)](https://travis-ci.org/farkasity/jekyll-diagrams.svg)
4
5
  [![Build status](https://ci.appveyor.com/api/projects/status/f5l7k3971pmjbjcq?svg=true)](https://ci.appveyor.com/project/farkasity/jekyll-diagrams)
5
6
  [![Dependency Status](https://gemnasium.com/farkasity/jekyll-diagrams.svg)](https://gemnasium.com/farkasity/jekyll-diagrams)
@@ -4,20 +4,20 @@ require 'tempfile'
4
4
  module Jekyll
5
5
  module Diagrams
6
6
  class DiagBlock < Liquid::Block
7
-     def initialize(tag_name, text, tokens)
8
-         super
9
-         @tag_name = tag_name
10
-       end
7
+ def initialize(tag_name, text, tokens)
8
+ super
9
+ @tag_name = tag_name
10
+ end
11
11
 
12
-       def render(context)
13
-         config = context.registers[:site].config["diagrams"]
12
+ def render(context)
13
+ config = context.registers[:site].config["diagrams"]
14
14
 
15
-         @renderer = DiagRenderer.new(config['diag'])
15
+ @renderer = DiagRenderer.new(config['diag'])
16
16
 
17
-         render_diagram(super)
18
-       end
17
+ render_diagram(super)
18
+ end
19
19
 
20
-       private
20
+ private
21
21
 
22
22
  def render_diagram(code)
23
23
  @renderer.render(code, @tag_name)
@@ -36,15 +36,15 @@ module Jekyll
36
36
  def render(code, engine)
37
37
  tmp = Temfile.new(engine).path
38
38
  dest = "#{tmp}.svg"
39
-
39
+
40
40
  File.write(tmp, code)
41
41
  cmd = "#{engine} #{@config['options']} #{tmp} -o #{dest}"
42
42
  ret, status = Open3.capture2(cmd, binmode: true)
43
43
 
44
- if !status.success?
44
+ if !status.success
45
45
  raise "Non-zero exit status '#{cmd}': #{status}"
46
46
  end
47
-
47
+
48
48
  svg = File.read(dest).force_encoding 'UTF-8'
49
49
 
50
50
  wrap_div(svg, engine)
@@ -3,24 +3,24 @@ require 'open3'
3
3
  module Jekyll
4
4
  module Diagrams
5
5
  class GraphvizBlock < Liquid::Block
6
-     def initialize(tag_name, text, tokens)
7
-         super
8
-         @tag_name = tag_name
9
-         @engine = text.strip
10
-       end
6
+ def initialize(tag_name, text, tokens)
7
+ super
8
+ @tag_name = tag_name
9
+ @engine = text.strip
10
+ end
11
11
 
12
-       def render(context)
13
-         config = context.registers[:site].config["diagrams"]
12
+ def render(context)
13
+ config = context.registers[:site].config["diagrams"]
14
14
 
15
-         @renderer = GraphvizRenderer.new(config["graphviz"])
15
+ @renderer = GraphvizRenderer.new(config["graphviz"])
16
16
 
17
-         render_diagram(super)
18
-       end
17
+ render_diagram(super)
18
+ end
19
19
 
20
-       private
20
+ private
21
21
 
22
-       def render_diagram(code)
23
-         code = case @tag_name
22
+ def render_diagram(code)
23
+ code = case @tag_name
24
24
  when 'graphviz'
25
25
  code
26
26
  when 'graph'
@@ -32,7 +32,7 @@ module Jekyll
32
32
  end
33
33
 
34
34
  @renderer.render(code, @engine)
35
-       end
35
+ end
36
36
  end
37
37
 
38
38
  class GraphvizRenderer
@@ -53,7 +53,7 @@ module Jekyll
53
53
  binmode: true
54
54
  )
55
55
 
56
- if !status.success?
56
+ if !status.success
57
57
  raise "Non-zero exit status '#{cmd}': #{status}"
58
58
  end
59
59
 
@@ -66,7 +66,7 @@ module Jekyll
66
66
  private
67
67
 
68
68
  def strip_metainfo(svg)
69
- svg.gsub(/(?:.*\n){6}/, '')
69
+ svg.gsub(/( :.*\n){6}/, '')
70
70
  end
71
71
 
72
72
  def wrap_div(svg)
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Diagrams
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-diagrams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - farkasity