svg_export 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 07072ca352508b8fbe82c6d06f2b70a35dafa356
|
|
4
|
+
data.tar.gz: 33cba0193c62d8f1820bafd58d6359319a216015
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c4ccdaf86a012e97567b48c1277c2ba6beabbee92908c90477416ed685c28b793f2a031b43fd7a4c85e4c90d925ebb5b4864625d20ff4f738a57fad71b23d53
|
|
7
|
+
data.tar.gz: db27bb1987f37e104cfe4efdfa90a7d6e560adb5d24de9fbdbc9ae44d3ad6617dbb07711363d7c1890bc5dbd4ad52891fde5d3b2a6c43d5f27928938c9c45a0d
|
data/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](http://badge.fury.io/rb/svg_export)
|
|
2
|
+
|
|
1
3
|
# Svg-Export Engine for Ruby on Rails
|
|
2
4
|
|
|
3
5
|
Highcharts compliant svg-rasterizer. To find more about Highcharts Exporting, look [here](http://www.highcharts.com/docs/export-module/export-module-overview)
|
|
@@ -12,6 +12,9 @@ module SvgExport
|
|
|
12
12
|
def call
|
|
13
13
|
transformer = @svg_transformer.new(@options)
|
|
14
14
|
svg = transformer.transform(params[:svg])
|
|
15
|
+
File.open('/tmp/jobwert-export-last.svg', 'w+') do |f|
|
|
16
|
+
f.write svg
|
|
17
|
+
end
|
|
15
18
|
infile.write(svg)
|
|
16
19
|
infile.flush
|
|
17
20
|
result = run!
|
|
@@ -19,6 +22,7 @@ module SvgExport
|
|
|
19
22
|
if fs.nil? || fs < 10
|
|
20
23
|
raise SvgExport::Error.new( "Output file empty; #{result}")
|
|
21
24
|
end
|
|
25
|
+
transformer.clear!
|
|
22
26
|
File.open(outfile)
|
|
23
27
|
end
|
|
24
28
|
|
|
@@ -5,6 +5,12 @@ module SvgExport
|
|
|
5
5
|
@base_url = options[:base_url]
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
+
def clear!
|
|
9
|
+
@tempfiles.each do |tf|
|
|
10
|
+
tf.unlink
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
8
14
|
def transform(svg)
|
|
9
15
|
doc = Nokogiri::XML.parse(svg)
|
|
10
16
|
doc.search('image').each do |image|
|
|
@@ -48,7 +54,12 @@ module SvgExport
|
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
end
|
|
51
|
-
|
|
57
|
+
without_hash = partial_path.gsub(/-([0-9a-f]+)(\.\w+)$/, '\2')
|
|
58
|
+
if without_hash != partial_path
|
|
59
|
+
find_asset_path(without_hash)
|
|
60
|
+
else
|
|
61
|
+
nil
|
|
62
|
+
end
|
|
52
63
|
end
|
|
53
64
|
end
|
|
54
65
|
end
|
data/lib/svg_export/version.rb
CHANGED