tbx_importer 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07eb739118c9dfa7659ad2042c6606c67d048081
4
- data.tar.gz: 44986383a0422d7b93d507bf364defe2f992e171
3
+ metadata.gz: beef3c040d792cb0b33f444ff477ca0cd0140eb7
4
+ data.tar.gz: 890bde70efad864d3e580392def4f7915b35685a
5
5
  SHA512:
6
- metadata.gz: e6f3dccb8ca9c9bf7f03136b4feeb951ab1069c7e5f4c119bb30f8516fd01e66e25cac523740aebe968988d307d985621b2279b6b683881bd55e00e53d0b3afc
7
- data.tar.gz: d8c974aa1b03cc0a1209f7a66a9c4d4336632a5014ae6359ac17d00a1446bcbce5e6ca9bdda501f2f13917dc01bba912c6d2eb6f4a16689b571fe96a3470ab04
6
+ metadata.gz: 4ac0e2d91e48b313d5b9125df873dfa9283d3e77194ee2be48bffd8e7a72a458b8e59281698cd0fea9e0d9ee99062890264761d3af1d2834ab4d8d9f737fea75
7
+ data.tar.gz: 8bb21f477e904713b5594f15ba0fba7d4df97b145261560b95b70c2fe05c13e03c8c1bfbe414c682319f0383f7b51ee32f0b75ed21743d038faa081714eda03f
data/lib/tbx_importer.rb CHANGED
@@ -121,11 +121,11 @@ module TbxImporter
121
121
  when [116, 101, 114, 109] #term
122
122
  write_term(reader)
123
123
  when [116, 101, 114, 109, 78, 111, 116, 101] #termNote
124
- @doc[:term][:part_of_speech] = PrettyStrings::Cleaner.new(reader.read_string.downcase).pretty.gsub("\\","\").gsub("'",%q(\\\')) if reader.get_attribute("type").eql?("partOfSpeech")
124
+ @doc[:term][:part_of_speech] = PrettyStrings::Cleaner.new(reader.read_string.downcase).pretty.gsub("\\","\").gsub("'",%q(\\\')).gsub("/",%q(\\\/)) if reader.get_attribute("type").eql?("partOfSpeech")
125
125
  @doc[:term][:vals].pop
126
126
  write_term(reader)
127
127
  when [100, 101, 115, 99, 114, 105, 112] #descrip
128
- @doc[:tc][:definition] = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\')) if reader.get_attribute("type").eql?("definition")
128
+ @doc[:tc][:definition] = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\')).gsub("/",%q(\\\/)) if reader.get_attribute("type").eql?("definition")
129
129
  @doc[:tc][:vals].pop
130
130
  write_tc
131
131
  end
@@ -138,7 +138,7 @@ module TbxImporter
138
138
 
139
139
  def write_term(reader)
140
140
  return if reader.read_string.nil?
141
- text = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\'))
141
+ text = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\')).gsub("/",%q(\\\/))
142
142
  word_count = text.gsub("\s+", ' ').split(' ').length
143
143
  @doc[:term][:vals] << [@doc[:tc][:id], @doc[:term][:lang], @doc[:term][:part_of_speech], text]
144
144
  end
@@ -1,3 +1,3 @@
1
1
  module TbxImporter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -50,6 +50,12 @@ describe TbxImporter do
50
50
  expect(tbx[1][1][2]).to eq("verb")
51
51
  end
52
52
 
53
+ it 'imports a UTF-8 TBX file 6' do
54
+ file_path = File.expand_path('../tbx_importer/spec/sample_files/sample_1(utf-8).tbx')
55
+ tbx = TbxImporter::Tbx.new(file_path: file_path).import
56
+ expect(tbx[0][4][1]).to eq("The mode of a command-line application where it does not display confirmation messages or any other user interface items that normally appear on screen. The switch for quiet mode is typically \\'\\/q\\'.")
57
+ end
58
+
53
59
  it 'imports a UTF-16 TBX file' do
54
60
  file_path = File.expand_path('../tbx_importer/spec/sample_files/sample_1(utf-16).tbx')
55
61
  tbx = TbxImporter::Tbx.new(file_path: file_path).import
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbx_importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler