85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/command/init.rb', line 85
def rewrite_aozoraepub3_files(aozora_path)
custom_chuki_tag_path = File.join(Narou.get_preset_dir, "custom_chuki_tag.txt")
chuki_tag_path = File.join(aozora_path, "chuki_tag.txt")
custom_chuki_tag = open(custom_chuki_tag_path, "r:BOM|UTF-8") { |fp| fp.read }
chuki_tag = open(chuki_tag_path, "r:BOM|UTF-8") { |fp| fp.read }
embedded_mark = "### Narou.rb embedded custom chuki ###"
if chuki_tag =~ /#{embedded_mark}/
chuki_tag.gsub!(/#{embedded_mark}.+#{embedded_mark}/m, custom_chuki_tag)
else
chuki_tag << "\n" + custom_chuki_tag
end
File.write(chuki_tag_path, chuki_tag)
puts "(次のファイルを書き換えました)"
puts chuki_tag_path
puts
src = ["AozoraEpub3.ini", "vertical_font.css"]
dst = ["AozoraEpub3.ini", "template/OPS/css_custom/vertical_font.css"]
puts "(次のファイルをコピーor上書きしました)"
src.size.times do |i|
src_full_path = File.join(Narou.get_preset_dir, src[i])
dst_full_path = File.join(aozora_path, dst[i])
FileUtils.install(src_full_path, dst_full_path)
puts dst_full_path
end
end
|