5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/tx_translate/md_process.rb', line 5
def self.run(filename)
file = File.open(filename, "r")
basename = File.basename(filename, "md")
contents = file.read
new_contents = ""
old_content_array = contents.split("\n\n")
new_content_array = ParallelArray.new(old_content_array).parallel_process
old_content_array.each_with_index do |item,i|
new_contents += old_content_array[i] + "\n\n" + new_content_array[i] + "\n\n"
end
file = File.open("#{basename}zh-si.md", "w") { |f| f.write(new_contents) }
end
|