tbx_importer 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tbx_importer.rb +3 -3
- data/lib/tbx_importer/version.rb +1 -1
- data/spec/tbx_importer_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec9c7b6bb928723684a9e3b2ef4517c8fbe538bf
|
4
|
+
data.tar.gz: 74d3cc51bb85a78b63b3200781f856d585ce635b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aad87de1e25bcf53397677fdf729da1d267b3982d17eada632703137fafc8ec6b7cd48b9ac6b5c61ede360b15bb52feb9a9fc8ffd2e0742dea071143c8f184a1
|
7
|
+
data.tar.gz: a612422432de5fca0edd42d639a8671c6d599e5cb645bc1fb68326745735ab96361ff6afc9f46dd10f846e7b7b4dc8154738920cac496e70934bdd3beb677feb
|
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(\\\')).gsub("/"
|
124
|
+
@doc[:term][:part_of_speech] = PrettyStrings::Cleaner.new(reader.read_string.downcase).pretty.gsub("\\","\").gsub("'",%q(\\\')).gsub("/", '') 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(\\\')).gsub("/"
|
128
|
+
@doc[:tc][:definition] = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\')).gsub("/", '') 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(\\\')).gsub("/"
|
141
|
+
text = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\')).gsub("/", '')
|
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
|
data/lib/tbx_importer/version.rb
CHANGED
data/spec/tbx_importer_spec.rb
CHANGED
@@ -53,7 +53,7 @@ describe TbxImporter do
|
|
53
53
|
it 'imports a UTF-8 TBX file 6' do
|
54
54
|
file_path = File.expand_path('../tbx_importer/spec/sample_files/sample_1(utf-8).tbx')
|
55
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 \\'
|
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
57
|
end
|
58
58
|
|
59
59
|
it 'imports a UTF-16 TBX file' do
|