ifmapper 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.txt +2 -0
- data/IFMapper.gemspec +1 -1
- data/lib/IFMapper/FXMapperSettings.rb +3 -1
- data/lib/IFMapper/IFMWriter.rb +8 -2
- data/lib/IFMapper/Inform7Writer.rb +15 -5
- data/lib/IFMapper/InformWriter.rb +14 -4
- data/lib/IFMapper/TADSWriter.rb +15 -5
- metadata +4 -4
data/HISTORY.txt
CHANGED
data/IFMapper.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |spec|
|
4
4
|
spec.name = "ifmapper"
|
5
|
-
spec.version = '1.2.
|
5
|
+
spec.version = '1.2.5'
|
6
6
|
spec.author = "Gonzalo Garramuno"
|
7
7
|
spec.email = 'ggarra13@gmail.com'
|
8
8
|
spec.homepage = 'http://www.rubyforge.org/projects/ifmapper/'
|
data/lib/IFMapper/IFMWriter.rb
CHANGED
@@ -69,8 +69,14 @@ class IFMWriter
|
|
69
69
|
return @elem[e] if @elem.has_key?(e)
|
70
70
|
|
71
71
|
tag = t.dup
|
72
|
-
|
73
|
-
|
72
|
+
|
73
|
+
if RUBY_VERSION < 1.9
|
74
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
75
|
+
tag = utf.iconv( tag )
|
76
|
+
else
|
77
|
+
tag = tag.encode( 'utf-8', :invalid => :replace,
|
78
|
+
:undef => :replace, :replace => '' )
|
79
|
+
end
|
74
80
|
|
75
81
|
tag.gsub!(/[\-\(\s,\.!'&"#$@\/\\\-\)]+/, '_')
|
76
82
|
tag.gsub!(/__/, '') # remove reduntant __ repetitions
|
@@ -211,8 +211,13 @@ class Inform7Writer
|
|
211
211
|
tag = str.dup
|
212
212
|
|
213
213
|
# Take text from Unicode utf-8 to iso-8859-1
|
214
|
-
|
215
|
-
|
214
|
+
if RUBY_VERSION < 1.9
|
215
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
216
|
+
tag = utf.iconv( tag )
|
217
|
+
else
|
218
|
+
tag = tag.encode( 'utf-8', :invalid => :replace,
|
219
|
+
:undef => :replace, :replace => '' )
|
220
|
+
end
|
216
221
|
|
217
222
|
# Remove redundant spaces
|
218
223
|
tag.sub!(/^\s/, '')
|
@@ -316,9 +321,14 @@ class Inform7Writer
|
|
316
321
|
def inform_quote(text)
|
317
322
|
str = text.dup
|
318
323
|
|
319
|
-
# Take text from Unicode utf-8 to iso-8859-1
|
320
|
-
|
321
|
-
|
324
|
+
# Take text from Unicode utf-8 to iso-8859-1859-1
|
325
|
+
if RUBY_VERSION < 1.9
|
326
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
327
|
+
str = utf.iconv( str )
|
328
|
+
else
|
329
|
+
str = str.encode( 'utf-8', :invalid => :replace,
|
330
|
+
:undef => :replace, :replace => '' )
|
331
|
+
end
|
322
332
|
|
323
333
|
# Quote special characters
|
324
334
|
# str.gsub!(/@/, '@@64')
|
@@ -35,8 +35,13 @@ class InformWriter
|
|
35
35
|
|
36
36
|
def new_tag(elem, str)
|
37
37
|
tag = str.dup
|
38
|
-
|
39
|
-
|
38
|
+
if RUBY_VERSION < 1.9
|
39
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
40
|
+
tag = utf.iconv( tag )
|
41
|
+
else
|
42
|
+
tag = tag.encode( 'utf-8', :invalid => :replace,
|
43
|
+
:undef => :replace, :replace => '' )
|
44
|
+
end
|
40
45
|
|
41
46
|
# Invalid tag characters, replaced with _
|
42
47
|
tag.gsub!(/[\s"'\/\\\-&#\,.:;!\?\n\(\)]/,'_')
|
@@ -107,8 +112,13 @@ class InformWriter
|
|
107
112
|
str = text.dup
|
108
113
|
|
109
114
|
# Take text from Unicode utf-8 to iso-8859-1
|
110
|
-
|
111
|
-
|
115
|
+
if RUBY_VERSION < 1.9
|
116
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
117
|
+
str = utf.iconv( str )
|
118
|
+
else
|
119
|
+
str = str.encode( 'utf-8', :invalid => :replace,
|
120
|
+
:undef => :replace, :replace => '' )
|
121
|
+
end
|
112
122
|
|
113
123
|
# Quote special characters
|
114
124
|
str.gsub!(/@/, '@@64')
|
data/lib/IFMapper/TADSWriter.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
s
|
2
2
|
|
3
3
|
class TADSWriter
|
4
4
|
|
@@ -38,8 +38,13 @@ class TADSWriter
|
|
38
38
|
tag = str.dup
|
39
39
|
|
40
40
|
# Take text from Unicode utf-8 to iso-8859-1
|
41
|
-
|
42
|
-
|
41
|
+
if RUBY_VERSION < 1.9
|
42
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
43
|
+
tag = utf.iconv( tag )
|
44
|
+
else
|
45
|
+
tag = tag.encode( 'utf-8', :invalid => :replace,
|
46
|
+
:undef => :replace, :replace => '' )
|
47
|
+
end
|
43
48
|
|
44
49
|
# Invalid tag characters, replaced with _
|
45
50
|
tag.gsub!(/[\s"'\/\\\-&#\,.:;!\?\n\(\)]/,'_')
|
@@ -115,8 +120,13 @@ class TADSWriter
|
|
115
120
|
str = text.dup
|
116
121
|
|
117
122
|
# Take text from Unicode utf-8 to iso-8859-1
|
118
|
-
|
119
|
-
|
123
|
+
if RUBY_VERSION < 1.9
|
124
|
+
utf = Iconv.new( 'iso-8859-1', 'utf-8' )
|
125
|
+
str = utf.iconv( str )
|
126
|
+
else
|
127
|
+
str = str.encode( 'utf-8', :invalid => :replace,
|
128
|
+
:undef => :replace, :replace => '' )
|
129
|
+
end
|
120
130
|
|
121
131
|
# Quote special characters
|
122
132
|
str.gsub!(/"/, '\"')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ifmapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 5
|
10
|
+
version: 1.2.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gonzalo Garramuno
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-09-
|
18
|
+
date: 2013-09-19 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake-compiler
|