rvpacker-txt 1.8.1 → 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 +4 -4
- data/lib/read.rb +25 -25
- data/lib/write.rb +3 -1
- data/rvpacker-txt.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5ce1335835077b4b76bf730aa575ea20154820b5b559f7d61380c79411b7e38
|
|
4
|
+
data.tar.gz: 0c3541e70ccd8e19a0b76bbc664dab7a4b577b9f6aea1c7cfa40347b4ddc7740
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d2fe0d75f34329cf4d81c7b8dea7d10c7cd428e0a95940d076cc3c792bfe5038df069ed2736a067defa80548baf96b541b6b457a51f4637d96279a7f90bec36
|
|
7
|
+
data.tar.gz: 7dc34c760e8d68817446552bd9930c3900ebe43bfac68bec9a5fa68ff23edceef0c6adcce353ea1f0554343994fbb6184f19fe0cf783dfca02d38e61dc938725
|
data/lib/read.rb
CHANGED
|
@@ -26,7 +26,7 @@ def self.extract_quoted_strings(string)
|
|
|
26
26
|
stripped = line.strip
|
|
27
27
|
|
|
28
28
|
next if stripped[0] == '#' ||
|
|
29
|
-
!stripped.match?(/["']/) ||
|
|
29
|
+
(!in_quotes && !stripped.match?(/["']/)) ||
|
|
30
30
|
stripped.start_with?(/(Win|Lose)|_Fanfare/) ||
|
|
31
31
|
stripped.match?(/eval\(/)
|
|
32
32
|
|
|
@@ -35,8 +35,6 @@ def self.extract_quoted_strings(string)
|
|
|
35
35
|
|
|
36
36
|
next if skip_block
|
|
37
37
|
|
|
38
|
-
buffer.push('\#') if in_quotes
|
|
39
|
-
|
|
40
38
|
line.each_char do |char|
|
|
41
39
|
if %w[' "].include?(char)
|
|
42
40
|
unless quote_type.nil? || char == quote_type
|
|
@@ -51,7 +49,16 @@ def self.extract_quoted_strings(string)
|
|
|
51
49
|
next
|
|
52
50
|
end
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
if in_quotes
|
|
53
|
+
if char == "\r"
|
|
54
|
+
next
|
|
55
|
+
elsif char == "\n"
|
|
56
|
+
buffer.push('\#')
|
|
57
|
+
next
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
buffer.push(char)
|
|
61
|
+
end
|
|
55
62
|
end
|
|
56
63
|
end
|
|
57
64
|
|
|
@@ -68,8 +75,9 @@ def self.parse_parameter(code, parameter, game_type)
|
|
|
68
75
|
when 401, 405
|
|
69
76
|
case game_type
|
|
70
77
|
when 'lisa'
|
|
71
|
-
match = parameter.scan(
|
|
72
|
-
|
|
78
|
+
match = parameter.scan(/^\\et\[[0-9]+\]/)
|
|
79
|
+
match = parameter.scan(/^\\nbt/) if match.empty?
|
|
80
|
+
parameter = parameter[match[0].length..] unless match.empty?
|
|
73
81
|
else
|
|
74
82
|
nil
|
|
75
83
|
end
|
|
@@ -86,23 +94,14 @@ def self.parse_parameter(code, parameter, game_type)
|
|
|
86
94
|
end
|
|
87
95
|
|
|
88
96
|
# @param [String] variable
|
|
89
|
-
# @param [String]
|
|
97
|
+
# @param [String] _game_type
|
|
90
98
|
# @return [String]
|
|
91
|
-
def self.parse_variable(variable,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
case game_type
|
|
99
|
-
when 'lisa'
|
|
100
|
-
return nil unless variable.split('\#').all? { |line| line.match?(/^<.*>\.?$/) || line.empty? }
|
|
101
|
-
else
|
|
102
|
-
nil
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
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/)
|
|
106
105
|
|
|
107
106
|
variable
|
|
108
107
|
end
|
|
@@ -349,11 +348,12 @@ def self.read_other(other_files_paths, output_path, logging, game_type, processi
|
|
|
349
348
|
unless allowed_codes.include?(code)
|
|
350
349
|
if in_sequence
|
|
351
350
|
joined = line.join('\#').strip
|
|
351
|
+
parsed = parse_parameter(401, joined, game_type)
|
|
352
352
|
|
|
353
|
-
other_translation_map.insert_at_index(other_lines.length,
|
|
354
|
-
!other_translation_map.include?(
|
|
353
|
+
other_translation_map.insert_at_index(other_lines.length, parsed, '') if inner_processing_type == :append &&
|
|
354
|
+
!other_translation_map.include?(parsed)
|
|
355
355
|
|
|
356
|
-
other_lines.add(
|
|
356
|
+
other_lines.add(parsed)
|
|
357
357
|
|
|
358
358
|
line.clear
|
|
359
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(
|
|
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.
|
|
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'
|