twine 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/twine/formatters/android.rb +7 -6
- data/lib/twine/version.rb +1 -1
- data/test/fixtures/test-output-1.txt +1 -1
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
2
|
+
require 'CGI'
|
3
3
|
require 'rexml/document'
|
4
4
|
|
5
5
|
module Twine
|
@@ -67,6 +67,8 @@ module Twine
|
|
67
67
|
value_match = value_regex.match(line)
|
68
68
|
if value_match
|
69
69
|
value = value_match[1]
|
70
|
+
value = CGI.unescapeHTML(value)
|
71
|
+
value.gsub!('\\\'', '\'')
|
70
72
|
value.gsub!('\\"', '"')
|
71
73
|
value = iosify_substitutions(value)
|
72
74
|
else
|
@@ -76,7 +78,7 @@ module Twine
|
|
76
78
|
set_tags_for_key(key, @options[:tags])
|
77
79
|
end
|
78
80
|
set_translation_for_key(key, lang, value)
|
79
|
-
if comment and comment.length > 0
|
81
|
+
if comment and comment.length > 0 and !comment.start_with?("SECTION:")
|
80
82
|
set_comment_for_key(key, comment)
|
81
83
|
end
|
82
84
|
comment = nil
|
@@ -107,7 +109,7 @@ module Twine
|
|
107
109
|
f.puts ''
|
108
110
|
if section.name && section.name.length > 0
|
109
111
|
section_name = section.name.gsub('--', '—')
|
110
|
-
f.puts "\t<!-- #{section_name} -->"
|
112
|
+
f.puts "\t<!-- SECTION: #{section_name} -->"
|
111
113
|
end
|
112
114
|
printed_section = true
|
113
115
|
end
|
@@ -126,9 +128,8 @@ module Twine
|
|
126
128
|
# 1) apostrophes and quotes must be escaped with a backslash
|
127
129
|
value.gsub!('\'', '\\\\\'')
|
128
130
|
value.gsub!('"', '\\\\"')
|
129
|
-
# 2)
|
130
|
-
value.
|
131
|
-
value.gsub!('<', '<')
|
131
|
+
# 2) HTML escape the string
|
132
|
+
value = CGI.escapeHTML(value)
|
132
133
|
# 3) fix substitutions (e.g. %s/%@)
|
133
134
|
value = androidify_substitutions(value)
|
134
135
|
|
data/lib/twine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubyzip
|