view repo.rb @ 3399:882e95746056

プログラムを改良
author houtin <c115080@g.koeki-u.ac.jp>
date Thu, 27 Jul 2017 07:12:37 +0900
parents eaacd1e8c03d
children
line wrap: on
line source

#!/usr/bin/ruby
# coding: euc-jp

time = Time.now

STDERR.print "綺(cssュ)\n"
STDERR.print "1.蕋合(food) 2ョ綺(shop) 3.篁(other):"
choice = gets.chomp

STDERR.print "綺:\n"
sbj = gets.chomp

history = ""
STDERR.print "罩翫(帥茵х篋)\n"
while true
  his = gets
  if his == ".\n" || his == nil then
    break
  end
  history += his
end

regend = ""
STDERR.print "篌茯(帥茵х篋)\n"
while true
  reg = gets
  if reg == ".\n" || reg == nil then
    break
  end
  regend += reg
end

STDERR.print "\n"
osu = gets.chomp

STDERR.print "灸梢\n"
yu = gets.chomp

STDERR.print "篏\n"
add = gets.chomp

STDERR.print "肢援\n"
tel = gets.chomp

STDERR.print "≪若:"
before = gets.chomp
STDERR.print "篆絖:"
after = gets.chomp
`convert -geometry 150x100 #{before}.jpg #{after}.jpg`

open("temp.txt", "r") do |cm|
  while x = cm.gets
    x.gsub!("%choice%", choice)
    x.gsub!("%time%", time.to_s)
    x.gsub!("%sbj%", sbj)
    x.gsub!("%after%", after)
    x.gsub!("%history%", "<p>"+history.chomp+"</p>")
    x.gsub!("%regend%", "<p>"+regend.chomp+"</p>")
    x.gsub!("%osu%", osu)
    x.gsub!("%yu%", yu)
    x.gsub!("%add%", add)
    x.gsub!("%tel%", tel)
    print x
  end
end

yatex.org