rvpacker-txt 1.9.1 → 1.9.4

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: ea9153be0a603a97b9e717c2406e5ca7dd650973b6905d2189fa9025fce0e596
4
- data.tar.gz: 4505485e158a91d4f57d81da8ef5faf19ae74d152dae5da99d6f7fa3cd28401d
3
+ metadata.gz: c57413528c8aa902963d9df851562c6dab33d8edbcdd8e19ef2c5dd0a3f5fbf0
4
+ data.tar.gz: 0aec862409028ee0f116a2ea98d08104c97bd3027969dd3ac830dbdbcf576c88
5
5
  SHA512:
6
- metadata.gz: b2b12ddb9a56f214daa46f8e4f47186ce44336713a98fbeebc279c9c8616f99c042100ff5be3d28cad99f35624cc52849a7abffbe68e19714e2454d211039df9
7
- data.tar.gz: b2d1b0bdb6e74e68a26591fb11b06eb4ef964122a2bc251e36b0be40dbec24e8153fbbca0b15bfe7c56bad96377c489fe556cc0332311aa22ac5d94168d91447
6
+ metadata.gz: 7a31f9ba7db0bd30345637c7701282191d842d053ccf38355331e1375f270fb6558fbfae4b2378174655c8968f5edba97354c2cee05ff580760c260db149c8e9
7
+ data.tar.gz: 2af993afb94e8d29705014bba95f655c26eec161da56f5715f9e7a069231e57456cd37b01678bd8de1148ac5f2d5858ff6c5b759902916eeb151569c2de9cc41
data/bin/rvpacker-txt CHANGED
@@ -21,9 +21,11 @@ def self.parse_options
21
21
  logging: false,
22
22
  force: false,
23
23
  append: false,
24
- shuffle_level: 0 }
24
+ shuffle_level: 0,
25
+ silent: false }
25
26
 
26
27
  options[:action] = ARGV[0]
28
+ options[:silent] = true unless ARGV.delete('--silent').nil?
27
29
 
28
30
  unless %w[read write].include?(options[:action])
29
31
  if %w[-h --help].include?(options[:action])
@@ -124,11 +126,13 @@ def self.parse_options
124
126
  end
125
127
  end
126
128
 
127
- cmd.on('-l', '--log', 'Enables logging.') do
129
+ cmd.on('-l', '--log',
130
+ 'Enables logging.') do
128
131
  options[:logging] = true
129
132
  end
130
133
 
131
- cmd.on('-h', '--help', "Prints the program's help message or for the entered subcommand.") do
134
+ cmd.on('-h', '--help',
135
+ "Prints the program's help message or for the entered subcommand.") do
132
136
  puts cmd
133
137
  exit
134
138
  end
@@ -166,6 +170,7 @@ force = options[:force]
166
170
  append = options[:append]
167
171
  # @type [Boolean]
168
172
  romanize = options[:romanize]
173
+ silent = options[:silent]
169
174
 
170
175
  extensions = { xp: 'rxdata', vx: 'rvdata', ace: 'rvdata2' }
171
176
 
@@ -215,14 +220,16 @@ if options[:action] == 'read'
215
220
  require 'read'
216
221
 
217
222
  processing_mode = if force
218
- wait_time_start = Time.now
223
+ unless options[:silent]
224
+ wait_time_start = Time.now
219
225
 
220
- puts "WARNING! You're about to forcefully rewrite all your translation files, including _trans files.",
221
- "If you really want to do it, make sure you've made a backup of your _trans files, if you made some changes in them already.",
222
- "Input 'Y' to continue."
223
- exit unless $stdin.gets.chomp == 'Y'
226
+ puts "WARNING! You're about to forcefully rewrite all your translation files, including _trans files.",
227
+ "If you really want to do it, make sure you've made a backup of your _trans files, if you made some changes in them already.",
228
+ "Input 'Y' to continue."
229
+ exit unless $stdin.gets.chomp == 'Y'
224
230
 
225
- $wait_time += Time.now - wait_time_start
231
+ $wait_time += Time.now - wait_time_start
232
+ end
226
233
  :force
227
234
  elsif append
228
235
  :append
data/lib/extensions.rb ADDED
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @param [String] string
4
+ # @return [String]
5
+ def self.romanize_string(string)
6
+ string.each_char.each_with_index do |char, i|
7
+ case char
8
+ when '。'
9
+ string[i] = '.'
10
+ when '、'
11
+ string[i] = ','
12
+ when '・'
13
+ string[i] = '·'
14
+ when '゠'
15
+ string[i] = '–'
16
+ when '='
17
+ string[i] = '—'
18
+ when '…', '‥'
19
+ string[i, 3] = '...'
20
+ when '「', '」', '〈', '〉'
21
+ string[i] = "'"
22
+ when '『', '』', '《', '》'
23
+ string[i] = '"'
24
+ when '(', '〔', '⦅', '〘'
25
+ string[i] = '('
26
+ when ')', '〕', '⦆', '〙'
27
+ string[i] = ')'
28
+ when '{'
29
+ string[i] = '{'
30
+ when '}'
31
+ string[i] = '}'
32
+ when '[', '【', '〖', '〚'
33
+ string[i] = '['
34
+ when ']', '】', '〗', '〛'
35
+ string[i] = ']'
36
+ when '〜'
37
+ string[i] = '~'
38
+ when '?'
39
+ string[i] = '?'
40
+ when ':'
41
+ string[i] = ':'
42
+ when '!'
43
+ string[i] = '!'
44
+ else
45
+ nil
46
+ end
47
+ end
48
+
49
+ string
50
+ end
data/lib/read.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'extensions'
4
3
  require 'zlib'
4
+ require_relative 'extensions'
5
5
 
6
6
  STRING_IS_ONLY_SYMBOLS_RE = /^[.()+-:;\[\]^~%&!*\/→×??x%▼| ]+$/
7
7
  APPEND_FLAG_OMIT_MSG = "Files aren't already parsed. Continuing as if --append flag was omitted."
data/lib/write.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'zlib'
4
- require 'extensions'
4
+ require_relative 'extensions'
5
5
 
6
6
  # @param [String] string A parsed scripts code string, containing raw Ruby code
7
7
  # @return [Array<Array<String, Integer>>] Hash of parsed from code strings and their start indices
@@ -444,7 +444,7 @@ def self.write_ini_title(ini_file_path, translated)
444
444
  title_line_index = file_lines.each_with_index { |line, i| break i if line.downcase.start_with?('title') }
445
445
  return if title_line_index.is_a?(Array)
446
446
 
447
- file_lines[title_line_index] = translated
447
+ file_lines[title_line_index] = "title =#{translated}"
448
448
  File.binwrite(ini_file_path, file_lines.join("\n"))
449
449
  end
450
450
 
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.9.1'
5
+ spec.version = '1.9.4'
6
6
  spec.authors = ['Howard Jeng', 'Andrew Kesterson', 'Solistra', 'Darkness9724', 'savannstm']
7
7
  spec.email = ['savannstm@gmail.com']
8
8
  spec.summary = 'Reads RPG Maker XP/VX/VXAce game text to .txt files and writes them to their initial form.'
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.metadata = { 'homepage_uri' => 'https://github.com/savannstm/rvpacker-txt' }
14
14
 
15
- spec.files = %w[bin/rvpacker-txt lib/classes.rb lib/read.rb lib/write.rb Gemfile LICENSE README.md rvpacker-txt.gemspec]
15
+ spec.files = %w[bin/rvpacker-txt lib/classes.rb lib/read.rb lib/write.rb lib/extensions.rb Gemfile LICENSE README.md rvpacker-txt.gemspec]
16
16
  spec.executables = ['rvpacker-txt']
17
17
  spec.require_paths = ['lib']
18
18
  end
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.9.1
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Howard Jeng
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2024-07-25 00:00:00.000000000 Z
15
+ date: 2024-07-26 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description:
18
18
  email:
@@ -27,6 +27,7 @@ files:
27
27
  - README.md
28
28
  - bin/rvpacker-txt
29
29
  - lib/classes.rb
30
+ - lib/extensions.rb
30
31
  - lib/read.rb
31
32
  - lib/write.rb
32
33
  - rvpacker-txt.gemspec