rvpacker-txt 1.8.2 → 1.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa47130be6188bd6cc7e662a705d3967640b9c20d359d6f1004cd8f87567c6fa
4
- data.tar.gz: 73107db4657b4f2790c6b1bbcbec6784c244729218eb9b0a26565a2371b3f985
3
+ metadata.gz: d5ce1335835077b4b76bf730aa575ea20154820b5b559f7d61380c79411b7e38
4
+ data.tar.gz: 0c3541e70ccd8e19a0b76bbc664dab7a4b577b9f6aea1c7cfa40347b4ddc7740
5
5
  SHA512:
6
- metadata.gz: 1ca284ed2546b82c36113e324c246af68d3f61f7365ee8a37dd6559dba81ef612027160e957935435e20532c36fe184ad4cb791bc389fb8f6a607f84eb489537
7
- data.tar.gz: 578030edf1a599864badba6f4ae5ba889d721aa5644731a7a462c438023fb5f5795543c7ccafd3468e8140243767523eb0dad8fecbfe5eafc42dae3fbaaa5f87
6
+ metadata.gz: 2d2fe0d75f34329cf4d81c7b8dea7d10c7cd428e0a95940d076cc3c792bfe5038df069ed2736a067defa80548baf96b541b6b457a51f4637d96279a7f90bec36
7
+ data.tar.gz: 7dc34c760e8d68817446552bd9930c3900ebe43bfac68bec9a5fa68ff23edceef0c6adcce353ea1f0554343994fbb6184f19fe0cf783dfca02d38e61dc938725
data/lib/read.rb CHANGED
@@ -75,8 +75,9 @@ def self.parse_parameter(code, parameter, game_type)
75
75
  when 401, 405
76
76
  case game_type
77
77
  when 'lisa'
78
- match = parameter.scan(/^(\\et\[[0-9]+\]|\\nbt)/)
79
- parameter = parameter.slice((match[0].length)..) unless match.empty?
78
+ match = parameter.scan(/^\\et\[[0-9]+\]/)
79
+ match = parameter.scan(/^\\nbt/) if match.empty?
80
+ parameter = parameter[match[0].length..] unless match.empty?
80
81
  else
81
82
  nil
82
83
  end
@@ -93,23 +94,14 @@ def self.parse_parameter(code, parameter, game_type)
93
94
  end
94
95
 
95
96
  # @param [String] variable
96
- # @param [String] game_type
97
+ # @param [String] _game_type
97
98
  # @return [String]
98
- def self.parse_variable(variable, game_type)
99
- unless game_type.nil?
100
- lines_count = variable.count("\n")
101
-
102
- if lines_count.positive?
103
- variable = variable.gsub(/\r?\n/, '\#')
104
-
105
- case game_type
106
- when 'lisa'
107
- return nil unless variable.split('\#').all? { |line| line.match?(/^<.*>\.?$/) || line.empty? }
108
- else
109
- nil
110
- end
111
- end
112
- end
99
+ def self.parse_variable(variable, _game_type)
100
+ variable = variable.gsub(/\r?\n/, '\#') if variable.count("\n").positive?
101
+ return nil if variable.split('\#').all? { |line| line.strip.match?(/(^#? ?<.*>\.?$)|^$/) }
102
+ return nil if variable.match?(/^[+-]?[0-9]*$/) ||
103
+ variable.match?(/---/) ||
104
+ variable.match?(/restrict eval/)
113
105
 
114
106
  variable
115
107
  end
@@ -356,11 +348,12 @@ def self.read_other(other_files_paths, output_path, logging, game_type, processi
356
348
  unless allowed_codes.include?(code)
357
349
  if in_sequence
358
350
  joined = line.join('\#').strip
351
+ parsed = parse_parameter(401, joined, game_type)
359
352
 
360
- other_translation_map.insert_at_index(other_lines.length, joined, '') if inner_processing_type == :append &&
361
- !other_translation_map.include?(joined)
353
+ other_translation_map.insert_at_index(other_lines.length, parsed, '') if inner_processing_type == :append &&
354
+ !other_translation_map.include?(parsed)
362
355
 
363
- other_lines.add(joined)
356
+ other_lines.add(parsed)
364
357
 
365
358
  line.clear
366
359
  in_sequence = false
data/lib/write.rb CHANGED
@@ -80,7 +80,8 @@ def self.get_parameter_translated(code, parameter, hashmap, game_type)
80
80
  when 401, 405
81
81
  case game_type
82
82
  when 'lisa'
83
- match = parameter.scan(/^(\\et\[[0-9]+\]|\\nbt)/)
83
+ match = parameter.scan(/^\\et\[[0-9]+\]/)
84
+ match = parameter.scan(/^\\nbt/) if match.empty?
84
85
 
85
86
  unless match.empty?
86
87
  lisa_start = match[0]
@@ -98,6 +99,7 @@ def self.get_parameter_translated(code, parameter, hashmap, game_type)
98
99
  end
99
100
 
100
101
  gotten = hashmap[parameter]
102
+ return nil if gotten.nil?
101
103
 
102
104
  case game_type
103
105
  when 'lisa'
data/rvpacker-txt.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'rvpacker-txt'
5
- spec.version = '1.8.2'
5
+ spec.version = '1.8.3'
6
6
  spec.authors = ['Howard Jeng', 'Andrew Kesterson', 'Solistra', 'Darkness9724', 'savannstm']
7
7
  spec.email = ['savannstm@gmail.com']
8
8
  spec.summary = 'Reads or writes RPG Maker XP/VX/VXAce game text to .txt files'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvpacker-txt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Howard Jeng