vectory 0.4.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +7 -1
  3. data/lib/vectory/capture.rb +115 -0
  4. data/lib/vectory/datauri.rb +1 -1
  5. data/lib/vectory/emf.rb +15 -0
  6. data/lib/vectory/eps.rb +9 -0
  7. data/lib/vectory/ps.rb +9 -0
  8. data/lib/vectory/svg.rb +11 -0
  9. data/lib/vectory/svg_mapping.rb +14 -7
  10. data/lib/vectory/system_call.rb +4 -3
  11. data/lib/vectory/utils.rb +80 -98
  12. data/lib/vectory/vector.rb +4 -0
  13. data/lib/vectory/version.rb +1 -1
  14. data/vectory.gemspec +5 -1
  15. metadata +17 -54
  16. data/bin/vectory +0 -9
  17. data/spec/examples/emf2eps/img.emf +0 -0
  18. data/spec/examples/emf2eps/img.emf.datauri +0 -1
  19. data/spec/examples/emf2eps/ref.eps +0 -88
  20. data/spec/examples/emf2ps/img.emf +0 -0
  21. data/spec/examples/emf2ps/ref.ps +0 -125
  22. data/spec/examples/emf2svg/img.emf +0 -0
  23. data/spec/examples/emf2svg/ref.svg +0 -9
  24. data/spec/examples/eps2emf/img.eps +0 -199
  25. data/spec/examples/eps2emf/img.eps.datauri +0 -1
  26. data/spec/examples/eps2emf/ref.emf +0 -0
  27. data/spec/examples/eps2ps/img.eps +0 -199
  28. data/spec/examples/eps2ps/ref.ps +0 -549
  29. data/spec/examples/eps2svg/img.eps +0 -199
  30. data/spec/examples/eps2svg/ref.svg +0 -173
  31. data/spec/examples/eps_but_svg_extension.svg +0 -199
  32. data/spec/examples/img.jpg +0 -0
  33. data/spec/examples/ps2emf/img.ps +0 -549
  34. data/spec/examples/ps2emf/img.ps.datauri +0 -1
  35. data/spec/examples/ps2emf/ref.emf +0 -0
  36. data/spec/examples/ps2eps/img.ps +0 -549
  37. data/spec/examples/ps2eps/ref.eps +0 -844
  38. data/spec/examples/ps2svg/img.ps +0 -549
  39. data/spec/examples/ps2svg/ref.svg +0 -476
  40. data/spec/examples/svg/action_schemaexpg1.svg +0 -124
  41. data/spec/examples/svg/action_schemaexpg2.svg +0 -124
  42. data/spec/examples/svg/doc-ref.xml +0 -109
  43. data/spec/examples/svg/doc.xml +0 -51
  44. data/spec/examples/svg/doc2-ref.xml +0 -59
  45. data/spec/examples/svg/doc2.xml +0 -28
  46. data/spec/examples/svg2emf/img.svg +0 -1
  47. data/spec/examples/svg2emf/img.svg.datauri +0 -1
  48. data/spec/examples/svg2emf/ref.emf +0 -0
  49. data/spec/examples/svg2eps/img.svg +0 -1
  50. data/spec/examples/svg2eps/ref.eps +0 -88
  51. data/spec/examples/svg2ps/img.svg +0 -1
  52. data/spec/examples/svg2ps/ref.ps +0 -125
  53. data/spec/spec_helper.rb +0 -22
  54. data/spec/support/matchers.rb +0 -51
  55. data/spec/support/text_matcher.rb +0 -63
  56. data/spec/support/vectory_helper.rb +0 -30
  57. data/spec/vectory/cli_spec.rb +0 -215
  58. data/spec/vectory/datauri_spec.rb +0 -181
  59. data/spec/vectory/emf_spec.rb +0 -62
  60. data/spec/vectory/eps_spec.rb +0 -67
  61. data/spec/vectory/file_magic_spec.rb +0 -24
  62. data/spec/vectory/inkscape_converter_spec.rb +0 -43
  63. data/spec/vectory/ps_spec.rb +0 -58
  64. data/spec/vectory/svg_mapping_spec.rb +0 -42
  65. data/spec/vectory/svg_spec.rb +0 -73
  66. data/spec/vectory/vector_spec.rb +0 -97
  67. data/spec/vectory_spec.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bff19041540b0039ebd4a816e88214e2d5d18ad238e3b4db67fd5765341e587
4
- data.tar.gz: d85d715fb24d936ada734ea3164aa516918fb23d7da6194ef17578b8192946a1
3
+ metadata.gz: 50efb043c71096f66bc72c7804b8707b6210ab4af071f231d7e81f52a0c66da0
4
+ data.tar.gz: a3ffda2f587f7796f2033fab1230db852d98e82da88b269d230646dad6acbd39
5
5
  SHA512:
6
- metadata.gz: 2d546b8081346f32e0264bb8a8629f77c1240729e15fc0ce0c3b61d33df3630696f4b82a7712c4e9f2ffcc7d336c8a686c14cbd47755a1a39690af890c688bb3
7
- data.tar.gz: b294e41a48e6aa93c73d51aa878e862c853531f58d3ca99123fd161482f3c3d0237a4f6c7165ff2dc0554e0b5f80293061ec5e253378c28c601c869a7077bac4
6
+ metadata.gz: aca9af8bee9a5f916fc0360b9473705307bfeda4b0086ae9fa53929381169a4791a483a126f98f1295574da06d70a2ea92bf3a706cd7359f91fa6b492c305205
7
+ data.tar.gz: '05286cb944c4235c5d60d5591b63be2d15c43f796fa0d63b00205ced005fe8c84f314c2d468fd5ec2a02336682d4b4c0357fd63bd6757056f95aa727ec8a3884'
data/README.adoc CHANGED
@@ -109,6 +109,12 @@ Each of them can be instantiated in several ways:
109
109
  ----
110
110
  Vectory::Eps.from_path("images/img.eps")
111
111
  Vectory::Eps.from_content("%!PS-Adobe-3.0...")
112
+ Vectory::Eps.from_datauri("data:image/svg+xml;base64,PHN2 ... 2Zz4=")
113
+ Vectory::Eps.from_node(Nokogiri::XML(
114
+ "<image mimetype="application/postscript" alt="3">
115
+ %!PS-Adobe-3.0 EPSF-3.0 ...
116
+ </image>"
117
+ ).child)
112
118
  ----
113
119
 
114
120
  Converting to other formats:
@@ -167,7 +173,7 @@ link references:
167
173
 
168
174
  [source,ruby]
169
175
  ----
170
- xml_string = Vectory::SvgMapping.from_path("doc.xml").call
176
+ xml_string = Vectory::SvgMapping.from_path("doc.xml").to_xml
171
177
  ----
172
178
 
173
179
  In order to do that an initial XML should support the `svgmap` tag with links
@@ -0,0 +1,115 @@
1
+ require "timeout"
2
+
3
+ module Vectory
4
+ module Capture
5
+ class << self
6
+ # rubocop:disable all
7
+ #
8
+ # Originally from https://gist.github.com/pasela/9392115
9
+ #
10
+ # Capture the standard output and the standard error of a command.
11
+ # Almost same as Open3.capture3 method except for timeout handling and return value.
12
+ # See Open3.capture3.
13
+ #
14
+ # result = capture3_with_timeout([env,] cmd... [, opts])
15
+ #
16
+ # The arguments env, cmd and opts are passed to Process.spawn except
17
+ # opts[:stdin_data], opts[:binmode], opts[:timeout], opts[:signal]
18
+ # and opts[:kill_after]. See Process.spawn.
19
+ #
20
+ # If opts[:stdin_data] is specified, it is sent to the command's standard input.
21
+ #
22
+ # If opts[:binmode] is true, internal pipes are set to binary mode.
23
+ #
24
+ # If opts[:timeout] is specified, SIGTERM is sent to the command after specified seconds.
25
+ #
26
+ # If opts[:signal] is specified, it is used instead of SIGTERM on timeout.
27
+ #
28
+ # If opts[:kill_after] is specified, also send a SIGKILL after specified seconds.
29
+ # it is only sent if the command is still running after the initial signal was sent.
30
+ #
31
+ # The return value is a Hash as shown below.
32
+ #
33
+ # {
34
+ # :pid => PID of the command,
35
+ # :status => Process::Status of the command,
36
+ # :stdout => the standard output of the command,
37
+ # :stderr => the standard error of the command,
38
+ # :timeout => whether the command was timed out,
39
+ # }
40
+ def with_timeout(*cmd)
41
+ spawn_opts = Hash === cmd.last ? cmd.pop.dup : {}
42
+ opts = {
43
+ :stdin_data => spawn_opts.delete(:stdin_data) || "",
44
+ :binmode => spawn_opts.delete(:binmode) || false,
45
+ :timeout => spawn_opts.delete(:timeout),
46
+ :signal => spawn_opts.delete(:signal) || :TERM,
47
+ :kill_after => spawn_opts.delete(:kill_after),
48
+ }
49
+
50
+ in_r, in_w = IO.pipe
51
+ out_r, out_w = IO.pipe
52
+ err_r, err_w = IO.pipe
53
+ in_w.sync = true
54
+
55
+ if opts[:binmode]
56
+ in_w.binmode
57
+ out_r.binmode
58
+ err_r.binmode
59
+ end
60
+
61
+ spawn_opts[:in] = in_r
62
+ spawn_opts[:out] = out_w
63
+ spawn_opts[:err] = err_w
64
+
65
+ result = {
66
+ :pid => nil,
67
+ :status => nil,
68
+ :stdout => nil,
69
+ :stderr => nil,
70
+ :timeout => false,
71
+ }
72
+
73
+ out_reader = nil
74
+ err_reader = nil
75
+ wait_thr = nil
76
+
77
+ begin
78
+ Timeout.timeout(opts[:timeout]) do
79
+ result[:pid] = spawn(*cmd, spawn_opts)
80
+ wait_thr = Process.detach(result[:pid])
81
+ in_r.close
82
+ out_w.close
83
+ err_w.close
84
+
85
+ out_reader = Thread.new { out_r.read }
86
+ err_reader = Thread.new { err_r.read }
87
+
88
+ in_w.write opts[:stdin_data]
89
+ in_w.close
90
+
91
+ result[:status] = wait_thr.value
92
+ end
93
+ rescue Timeout::Error
94
+ result[:timeout] = true
95
+ pid = spawn_opts[:pgroup] ? -result[:pid] : result[:pid]
96
+ Process.kill(opts[:signal], pid)
97
+ if opts[:kill_after]
98
+ unless wait_thr.join(opts[:kill_after])
99
+ Process.kill(:KILL, pid)
100
+ end
101
+ end
102
+ ensure
103
+ result[:status] = wait_thr.value if wait_thr
104
+ result[:stdout] = out_reader.value if out_reader
105
+ result[:stderr] = err_reader.value if err_reader
106
+ out_r.close unless out_r.closed?
107
+ err_r.close unless err_r.closed?
108
+ end
109
+
110
+ result
111
+ end
112
+ # rubocop:enable all
113
+ end
114
+ end
115
+ end
@@ -51,7 +51,7 @@ module Vectory
51
51
  def detect_image_class(image_type)
52
52
  case image_type
53
53
  when Eps.mimetype then return Eps
54
- when Emf.mimetype then return Emf
54
+ when *Emf.all_mimetypes then return Emf
55
55
  when Svg.mimetype then return Svg
56
56
  end
57
57
 
data/lib/vectory/emf.rb CHANGED
@@ -8,10 +8,25 @@ module Vectory
8
8
  "emf"
9
9
  end
10
10
 
11
+ def self.all_mimetypes
12
+ [mimetype] + alternative_mimetypes
13
+ end
14
+
11
15
  def self.mimetype
12
16
  "image/emf"
13
17
  end
14
18
 
19
+ def self.alternative_mimetypes
20
+ ["application/x-msmetafile"]
21
+ end
22
+
23
+ def self.from_node(node)
24
+ uri = node["src"]
25
+ return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)
26
+
27
+ from_path(uri)
28
+ end
29
+
15
30
  def to_svg
16
31
  with_file("emf") do |input_path|
17
32
  content = Emf2svg.from_file(input_path).sub(/<\?[^>]+>/, "")
data/lib/vectory/eps.rb CHANGED
@@ -10,6 +10,15 @@ module Vectory
10
10
  "application/postscript"
11
11
  end
12
12
 
13
+ def self.from_node(node)
14
+ return from_content(node.children.to_xml) unless node.text.strip.empty?
15
+
16
+ uri = node["src"]
17
+ return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)
18
+
19
+ from_path(uri)
20
+ end
21
+
13
22
  def to_ps
14
23
  convert_with_inkscape("--export-type=ps", Ps)
15
24
  end
data/lib/vectory/ps.rb CHANGED
@@ -10,6 +10,15 @@ module Vectory
10
10
  "application/postscript"
11
11
  end
12
12
 
13
+ def self.from_node(node)
14
+ return from_content(node.children.to_xml) unless node.text.strip.empty?
15
+
16
+ uri = node["src"]
17
+ return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)
18
+
19
+ from_path(uri)
20
+ end
21
+
13
22
  def to_eps
14
23
  convert_with_inkscape("--export-type=eps", Eps)
15
24
  end
data/lib/vectory/svg.rb CHANGED
@@ -14,6 +14,17 @@ module Vectory
14
14
  "image/svg+xml"
15
15
  end
16
16
 
17
+ def self.from_node(node)
18
+ if node.elements&.first&.name == "svg"
19
+ return from_content(node.children.to_xml)
20
+ end
21
+
22
+ uri = node["src"]
23
+ return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)
24
+
25
+ from_path(uri)
26
+ end
27
+
17
28
  def content
18
29
  @document&.to_xml || @content
19
30
  end
@@ -22,23 +22,30 @@ module Vectory
22
22
  "processing-instruction()|.//processing-instruction()".freeze
23
23
 
24
24
  def self.from_path(path)
25
- new(File.read(path))
25
+ new(Nokogiri::XML(File.read(path)))
26
26
  end
27
27
 
28
- def initialize(xml, local_directory = "")
29
- @xml = xml
28
+ def self.from_xml(xml)
29
+ new(Nokogiri::XML(xml))
30
+ end
31
+
32
+ def initialize(doc, local_directory = "")
33
+ @doc = doc
30
34
  @local_directory = local_directory
31
35
  end
32
36
 
33
37
  def call
34
- xmldoc = Nokogiri::XML(@xml)
35
- @namespace = Namespace.new(xmldoc)
38
+ @namespace = Namespace.new(@doc)
36
39
 
37
- xmldoc.xpath(@namespace.ns("//svgmap")).each_with_index do |svgmap, index|
40
+ @doc.xpath(@namespace.ns("//svgmap")).each_with_index do |svgmap, index|
38
41
  process_svgmap(svgmap, index)
39
42
  end
40
43
 
41
- xmldoc.to_xml
44
+ @doc
45
+ end
46
+
47
+ def to_xml
48
+ call.to_xml
42
49
  end
43
50
 
44
51
  private
@@ -1,4 +1,5 @@
1
1
  require "open3"
2
+ require_relative "capture"
2
3
 
3
4
  module Vectory
4
5
  class SystemCall
@@ -30,9 +31,9 @@ module Vectory
30
31
  end
31
32
 
32
33
  def execute(cmd)
33
- result = Utils.capture3_with_timeout(cmd,
34
- timeout: @timeout,
35
- kill_after: @timeout)
34
+ result = Capture.with_timeout(cmd,
35
+ timeout: @timeout,
36
+ kill_after: @timeout)
36
37
  @stdout = result[:stdout]
37
38
  @stderr = result[:stderr]
38
39
  @status = result[:status]
data/lib/vectory/utils.rb CHANGED
@@ -1,117 +1,99 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "timeout"
3
+ require "base64"
4
+ require "marcel"
5
+ require "tempfile"
4
6
 
5
7
  module Vectory
6
8
  class Utils
7
9
  class << self
8
- # rubocop:disable all
10
+ # Extracted from https://github.com/metanorma/metanorma-utils/blob/v1.5.2/lib/utils/image.rb
9
11
  #
10
- # Originally from https://gist.github.com/pasela/9392115
11
- #
12
- # Capture the standard output and the standard error of a command.
13
- # Almost same as Open3.capture3 method except for timeout handling and return value.
14
- # See Open3.capture3.
15
- #
16
- # result = capture3_with_timeout([env,] cmd... [, opts])
17
- #
18
- # The arguments env, cmd and opts are passed to Process.spawn except
19
- # opts[:stdin_data], opts[:binmode], opts[:timeout], opts[:signal]
20
- # and opts[:kill_after]. See Process.spawn.
21
- #
22
- # If opts[:stdin_data] is specified, it is sent to the command's standard input.
23
- #
24
- # If opts[:binmode] is true, internal pipes are set to binary mode.
25
- #
26
- # If opts[:timeout] is specified, SIGTERM is sent to the command after specified seconds.
27
- #
28
- # If opts[:signal] is specified, it is used instead of SIGTERM on timeout.
29
- #
30
- # If opts[:kill_after] is specified, also send a SIGKILL after specified seconds.
31
- # it is only sent if the command is still running after the initial signal was sent.
32
- #
33
- # The return value is a Hash as shown below.
34
- #
35
- # {
36
- # :pid => PID of the command,
37
- # :status => Process::Status of the command,
38
- # :stdout => the standard output of the command,
39
- # :stderr => the standard error of the command,
40
- # :timeout => whether the command was timed out,
41
- # }
42
- def capture3_with_timeout(*cmd)
43
- spawn_opts = Hash === cmd.last ? cmd.pop.dup : {}
44
- opts = {
45
- :stdin_data => spawn_opts.delete(:stdin_data) || "",
46
- :binmode => spawn_opts.delete(:binmode) || false,
47
- :timeout => spawn_opts.delete(:timeout),
48
- :signal => spawn_opts.delete(:signal) || :TERM,
49
- :kill_after => spawn_opts.delete(:kill_after),
50
- }
12
+ # sources/plantuml/plantuml20200524-90467-1iqek5i.png
13
+ # already includes localdir
14
+ # Check whether just the local path or the other specified relative path
15
+ # works.
16
+ def datauri(uri, local_dir = ".")
17
+ (datauri?(uri) || url?(uri)) and return uri
18
+
19
+ path = path_which_exist(uri, local_dir)
20
+ path and return encode_datauri(path)
51
21
 
52
- in_r, in_w = IO.pipe
53
- out_r, out_w = IO.pipe
54
- err_r, err_w = IO.pipe
55
- in_w.sync = true
22
+ warn "Image specified at `#{uri}` does not exist."
23
+ uri # Return original provided location
24
+ end
56
25
 
57
- if opts[:binmode]
58
- in_w.binmode
59
- out_r.binmode
60
- err_r.binmode
26
+ def path_which_exist(uri, local_dir)
27
+ options = absolute_path?(uri) ? [uri] : [uri, File.join(local_dir, uri)]
28
+ options.detect do |p|
29
+ File.file?(p)
61
30
  end
31
+ end
62
32
 
63
- spawn_opts[:in] = in_r
64
- spawn_opts[:out] = out_w
65
- spawn_opts[:err] = err_w
33
+ def encode_datauri(path)
34
+ return nil unless File.exist?(path)
66
35
 
67
- result = {
68
- :pid => nil,
69
- :status => nil,
70
- :stdout => nil,
71
- :stderr => nil,
72
- :timeout => false,
73
- }
36
+ type = Marcel::MimeType.for(Pathname.new(path)) ||
37
+ 'text/plain; charset="utf-8"'
38
+
39
+ bin = File.binread(path)
40
+ data = Base64.strict_encode64(bin)
41
+ "data:#{type};base64,#{data}"
42
+ # rescue StandardError
43
+ # warn "Data-URI encoding of `#{path}` failed."
44
+ # nil
45
+ end
46
+
47
+ def datauri?(uri)
48
+ /^data:/.match?(uri)
49
+ end
50
+
51
+ def url?(url)
52
+ %r{^[A-Z]{2,}://}i.match?(url)
53
+ end
54
+
55
+ def absolute_path?(uri)
56
+ %r{^/}.match?(uri) || %r{^[A-Z]:/}.match?(uri)
57
+ end
58
+
59
+ def svgmap_rewrite0_path(src, localdirectory)
60
+ if /^data:/.match?(src)
61
+ save_dataimage(src)
62
+ else
63
+ File.file?(src) ? src : localdirectory + src
64
+ end
65
+ end
74
66
 
75
- out_reader = nil
76
- err_reader = nil
77
- wait_thr = nil
78
-
79
- begin
80
- Timeout.timeout(opts[:timeout]) do
81
- result[:pid] = spawn(*cmd, spawn_opts)
82
- wait_thr = Process.detach(result[:pid])
83
- in_r.close
84
- out_w.close
85
- err_w.close
86
-
87
- out_reader = Thread.new { out_r.read }
88
- err_reader = Thread.new { err_r.read }
89
-
90
- in_w.write opts[:stdin_data]
91
- in_w.close
92
-
93
- result[:status] = wait_thr.value
94
- end
95
- rescue Timeout::Error
96
- result[:timeout] = true
97
- pid = spawn_opts[:pgroup] ? -result[:pid] : result[:pid]
98
- Process.kill(opts[:signal], pid)
99
- if opts[:kill_after]
100
- unless wait_thr.join(opts[:kill_after])
101
- Process.kill(:KILL, pid)
102
- end
103
- end
104
- ensure
105
- result[:status] = wait_thr.value if wait_thr
106
- result[:stdout] = out_reader.value if out_reader
107
- result[:stderr] = err_reader.value if err_reader
108
- out_r.close unless out_r.closed?
109
- err_r.close unless err_r.closed?
67
+ def save_dataimage(uri)
68
+ %r{^data:(?:image|application)/(?<imgtype>[^;]+);(?:charset=[^;]+;)?base64,(?<imgdata>.+)$} =~ uri # rubocop:disable Layout/LineLength
69
+ imgtype.sub!(/\+[a-z0-9]+$/, "") # svg+xml
70
+ imgtype = "png" unless /^[a-z0-9]+$/.match? imgtype
71
+ Tempfile.open(["image", ".#{imgtype}"]) do |f|
72
+ f.binmode
73
+ f.write(Base64.strict_decode64(imgdata))
74
+ f.path
110
75
  end
76
+ end
77
+
78
+ # FIXME: This method should ONLY return 1 type, remove Array wrapper
79
+ def datauri2mime(uri)
80
+ output = decode_datauri(uri)
81
+ return nil unless output && output[:type_detected]
111
82
 
112
- result
83
+ [output[:type_detected]]
84
+ end
85
+
86
+ def decode_datauri(uri)
87
+ %r{^data:(?<mimetype>[^;]+);base64,(?<mimedata>.+)$} =~ uri
88
+ return nil unless mimetype && mimedata
89
+
90
+ data = Base64.strict_decode64(mimedata)
91
+ {
92
+ type_declared: mimetype,
93
+ type_detected: Marcel::MimeType.for(data, declared_type: mimetype),
94
+ data: data,
95
+ }
113
96
  end
114
- # rubocop:enable all
115
97
  end
116
98
  end
117
99
  end
@@ -10,6 +10,10 @@ module Vectory
10
10
  new(content, path)
11
11
  end
12
12
 
13
+ def self.from_datauri(uri)
14
+ Datauri.new(uri).to_vector
15
+ end
16
+
13
17
  def self.default_extension
14
18
  raise Vectory::NotImplementedError,
15
19
  "#default_extension should be implemented in a subclass."
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vectory
4
- VERSION = "0.4.2"
4
+ VERSION = "0.6.0"
5
5
  end
data/vectory.gemspec CHANGED
@@ -20,10 +20,14 @@ Gem::Specification.new do |spec|
20
20
  spec.bindir = "exe"
21
21
  spec.executables = ["vectory"]
22
22
  spec.require_paths = ["lib"]
23
- spec.files = `git ls-files`.split("\n")
23
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
24
+ f.match(%r{^(bin|spec)/})
25
+ end
26
+ spec.test_files = `git ls-files -- {spec}/*`.split("\n")
24
27
  spec.required_ruby_version = ">= 2.5.0"
25
28
 
26
29
  spec.add_runtime_dependency "emf2svg"
30
+ spec.add_runtime_dependency "marcel", "~> 1.0.0"
27
31
  spec.add_runtime_dependency "nokogiri", "~> 1.14"
28
32
  spec.add_runtime_dependency "thor", "~> 1.2.1"
29
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vectory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-07 00:00:00.000000000 Z
11
+ date: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: emf2svg
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: marcel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: nokogiri
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -71,9 +85,9 @@ files:
71
85
  - Gemfile
72
86
  - README.adoc
73
87
  - Rakefile
74
- - bin/vectory
75
88
  - exe/vectory
76
89
  - lib/vectory.rb
90
+ - lib/vectory/capture.rb
77
91
  - lib/vectory/cli.rb
78
92
  - lib/vectory/datauri.rb
79
93
  - lib/vectory/emf.rb
@@ -88,57 +102,6 @@ files:
88
102
  - lib/vectory/utils.rb
89
103
  - lib/vectory/vector.rb
90
104
  - lib/vectory/version.rb
91
- - spec/examples/emf2eps/img.emf
92
- - spec/examples/emf2eps/img.emf.datauri
93
- - spec/examples/emf2eps/ref.eps
94
- - spec/examples/emf2ps/img.emf
95
- - spec/examples/emf2ps/ref.ps
96
- - spec/examples/emf2svg/img.emf
97
- - spec/examples/emf2svg/ref.svg
98
- - spec/examples/eps2emf/img.eps
99
- - spec/examples/eps2emf/img.eps.datauri
100
- - spec/examples/eps2emf/ref.emf
101
- - spec/examples/eps2ps/img.eps
102
- - spec/examples/eps2ps/ref.ps
103
- - spec/examples/eps2svg/img.eps
104
- - spec/examples/eps2svg/ref.svg
105
- - spec/examples/eps_but_svg_extension.svg
106
- - spec/examples/img.jpg
107
- - spec/examples/ps2emf/img.ps
108
- - spec/examples/ps2emf/img.ps.datauri
109
- - spec/examples/ps2emf/ref.emf
110
- - spec/examples/ps2eps/img.ps
111
- - spec/examples/ps2eps/ref.eps
112
- - spec/examples/ps2svg/img.ps
113
- - spec/examples/ps2svg/ref.svg
114
- - spec/examples/svg/action_schemaexpg1.svg
115
- - spec/examples/svg/action_schemaexpg2.svg
116
- - spec/examples/svg/doc-ref.xml
117
- - spec/examples/svg/doc.xml
118
- - spec/examples/svg/doc2-ref.xml
119
- - spec/examples/svg/doc2.xml
120
- - spec/examples/svg2emf/img.svg
121
- - spec/examples/svg2emf/img.svg.datauri
122
- - spec/examples/svg2emf/ref.emf
123
- - spec/examples/svg2eps/img.svg
124
- - spec/examples/svg2eps/ref.eps
125
- - spec/examples/svg2ps/img.svg
126
- - spec/examples/svg2ps/ref.ps
127
- - spec/spec_helper.rb
128
- - spec/support/matchers.rb
129
- - spec/support/text_matcher.rb
130
- - spec/support/vectory_helper.rb
131
- - spec/vectory/cli_spec.rb
132
- - spec/vectory/datauri_spec.rb
133
- - spec/vectory/emf_spec.rb
134
- - spec/vectory/eps_spec.rb
135
- - spec/vectory/file_magic_spec.rb
136
- - spec/vectory/inkscape_converter_spec.rb
137
- - spec/vectory/ps_spec.rb
138
- - spec/vectory/svg_mapping_spec.rb
139
- - spec/vectory/svg_spec.rb
140
- - spec/vectory/vector_spec.rb
141
- - spec/vectory_spec.rb
142
105
  - tmp/.keep
143
106
  - vectory.gemspec
144
107
  homepage: https://github.com/metanorma/vectory
data/bin/vectory DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "vectory/cli"
5
-
6
- Vectory.ui.level = Logger::INFO
7
-
8
- status_code = Vectory::CLI.start(ARGV)
9
- exit status_code.is_a?(Integer) ? status_code : Vectory::CLI::STATUS_UNKNOWN_ERROR
Binary file
@@ -1 +0,0 @@
1
- data:image/emf;base64,AQAAANQAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAMAQAACgAAAACAAAANAAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADMAIAAoADAAZQAxADUAMABlAGQALAAgADIAMAAyADMALQAwADcALQAyADEAKQAgAAAAZgBpAGwAZQAzAC4AcwB2AGcALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAMAQAAA==