xliffle 0.5.0 → 0.5.1
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 +4 -4
- data/lib/xliffle/string.rb +20 -6
- data/lib/xliffle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ace3fab48a2d11de7322dabcf02a7c3a7d0e3321f2aef63302875d101ffce782
|
|
4
|
+
data.tar.gz: ef95216b3d08fa667fcca163b3c519a1c397162f5ad49353fdbf450a581d5edc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0fda7f113e5fc0f17aa52bf03305199aa5d5fc421c03bb72dc302142a479d0a5d13a7e42f949fec42fbbbae671a6056ee0846901faf62fd48554c39e38321c66
|
|
7
|
+
data.tar.gz: d632acd0ac214a3d4e7833bc62f16489c85cf72dd7290091013fcef59aa7c999ff763c56a8050db098802788247b286ef63fcac914bf2818e5e430c81a55ed6c
|
data/lib/xliffle/string.rb
CHANGED
|
@@ -41,27 +41,41 @@ module Xliffle
|
|
|
41
41
|
def add_source_segment(tag)
|
|
42
42
|
return tag.source unless @source_string
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if @options[:no_escaping]
|
|
45
|
+
inline_tag(tag, :source, @source_string)
|
|
46
|
+
else
|
|
47
|
+
tag.source do |xml|
|
|
48
|
+
segment(xml, @source_string)
|
|
49
|
+
end
|
|
46
50
|
end
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
def add_target_segment(tag)
|
|
50
54
|
return tag.target unless @target_string
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
if @options[:no_escaping]
|
|
57
|
+
inline_tag(tag, :target, @target_string)
|
|
58
|
+
else
|
|
59
|
+
tag.target do |xml|
|
|
60
|
+
segment(xml, @target_string)
|
|
61
|
+
end
|
|
54
62
|
end
|
|
55
63
|
end
|
|
56
64
|
|
|
57
65
|
def segment(tag, value)
|
|
58
66
|
if @options[:use_cdata] && value
|
|
59
67
|
tag.cdata!(value)
|
|
60
|
-
elsif @options[:no_escaping] && value
|
|
61
|
-
tag << value
|
|
62
68
|
else
|
|
63
69
|
tag.text!(value)
|
|
64
70
|
end
|
|
65
71
|
end
|
|
72
|
+
|
|
73
|
+
def inline_tag(tag, name, value)
|
|
74
|
+
tag.__send__(:_indent)
|
|
75
|
+
tag.__send__(:_start_tag, name, {})
|
|
76
|
+
tag.__send__(:_text, value)
|
|
77
|
+
tag.__send__(:_end_tag, name)
|
|
78
|
+
tag.__send__(:_newline)
|
|
79
|
+
end
|
|
66
80
|
end
|
|
67
81
|
end
|
data/lib/xliffle/version.rb
CHANGED