#!/usr/koeki/bin/ruby # -*- coding: utf-8 -*- STDERR.print "何食べた?: " menu = gets.chomp STDERR.print "写真があるならそのファイル名: " photo = gets.chomp if photo != "" then photo = '' end comment = "" STDERR.puts "コメントをどうぞ(ピリオドのみの行でおしまい)" while true com1 = gets if com1 == ".\n" || com1 == nil then # nilはC-dで入力終了したとき break end comment += com1 end open("delicious.txt", "r") do |dt| while x = dt.gets x.gsub!("%menu%", menu) x.gsub!("%photo%", photo) x.gsub!("%text%", "

"+comment.chomp+"

") print x end end