ipynbdiff 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/output_transformer.rb +3 -7
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff3a6405d5c4034108fee997d678bee634a516f1d773b0aa9e8c7e4f50b7f28e
|
4
|
+
data.tar.gz: 3a80027ec239810e6b3daaa637fc338c5a34e3ae75c2f33043303eb6e16f6980
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d126961600c8073f2ead97b26d2879f987f15d6e3c74f0c9e2bd64c020bc8fd7963f4b50a69fd28c98728c645b595dbdda5883f4f56e18aa949df589e3787d0
|
7
|
+
data.tar.gz: 30e2c855b51de45ad2147419a455a4adc8f4f3cd30445f32a9667e3f17a072c3e59bcc8e603e34be2c7216e0b9671e2ed283e827780b4da25bff4be03f733ed6
|
data/lib/output_transformer.rb
CHANGED
@@ -52,24 +52,20 @@ module IpynbDiff
|
|
52
52
|
new_symbol = symbol_prefix / output_type
|
53
53
|
case output_type
|
54
54
|
when 'image/png', 'image/jpeg'
|
55
|
-
transform_image(output_type, output_element, new_symbol)
|
55
|
+
transform_image(output_type + ';base64', output_element, new_symbol)
|
56
56
|
when 'image/svg+xml'
|
57
|
-
|
57
|
+
transform_image(output_type + ';utf8', output_element, new_symbol)
|
58
58
|
when 'text/markdown', 'text/latex', 'text/plain', 'text'
|
59
59
|
transform_text(output_element, new_symbol)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
def transform_image(image_type, image_content, symbol)
|
64
|
-
_(symbol, " ![](data:#{image_type};base64,#{image_content.gsub("\n", '')})")
|
65
|
-
end
|
66
|
-
|
67
|
-
def transform_svg(image_content, symbol)
|
68
64
|
lines = image_content.is_a?(Array) ? image_content : [image_content]
|
69
65
|
|
70
66
|
single_line = lines.map(&:strip).join.gsub(/\s+/, ' ')
|
71
67
|
|
72
|
-
_(symbol, " ![](data
|
68
|
+
_(symbol, " ![](data:#{image_type},#{single_line})")
|
73
69
|
end
|
74
70
|
|
75
71
|
def transform_text(text_content, symbol)
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipynbdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Bonet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|