Mercurial > hgrepos > hgweb.cgi > skipweb
changeset 2154:f0290e772b25
プログラム追加
author | KAMADA Kei <c110206@f.koeki-u.ac.jp> |
---|---|
date | Thu, 21 Nov 2013 16:33:48 +0900 |
parents | f7a3a3f60fbb |
children | 064c7401eb5c |
files | ruby/pro2.rb ruby/sample.jpg ruby/temp.txt |
diffstat | 3 files changed, 113 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ruby/pro2.rb Thu Nov 21 16:33:48 2013 +0900 @@ -0,0 +1,87 @@ +#!/usr/bin/ruby +# coding: euc-jp + +require 'fileutils' +time = Time.now + +if ARGV[0] == nil + STDERR.print "./pro2.rb <ゃ.html ц儀\n" + exit(1) +end + +name = ARGV[0].to_s + +open(name, "w") do |out| + css = ["syuzai", "enq", "other"] + x = 0 + STDERR.print "綺(垩御)\n" + STDERR.print "1.篌茯 2.≪潟宴若茯炊:" + sentaku = STDIN.gets.chomp.to_i + choice = css[sentaku-1] + + STDERR.print "綺:" + sbj = STDIN.gets.chomp + + history = "" + STDERR.print "罩翫(return 2若腟篋)\n" + while true + his = STDIN.gets + if his == "\n" || his == nil then + break + end + history += his + end + + regend = "" + STDERR.print "篌茯(return 2若腟篋)\n" + while true + reg = STDIN.gets + if reg == "\n" || reg == nil then + break + end + regend += reg + end + + STDERR.print "\n" + osu = STDIN.gets.chomp + + STDERR.print "灸梢(茹)\n" + yu = STDIN.gets.chomp + + STDERR.print "篏\n" + add = STDIN.gets.chomp + + STDERR.print "肢援(茹)\n" + tel = STDIN.gets.chomp + + STDERR.print "≪若\n" + STDERR.print "糸吾с:" + before = STDIN.gets.chomp + + STDERR.print "篆絖糸羆冴:" + after = STDIN.gets.chomp + `convert -geometry 150x100 #{before} #{after}` + STDERR.print "糸picture/ 篆絖障\n" + FileUtils.mv(after, '/home/Kei/public_html/demo/') + + STDERR.print "篆絖絎:" + save = STDIN.gets.chomp + FileUtils.mv(name, save) + STDERR.print "篆絖障\n" + + 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%", "<pre>"+history.chomp+"</pre>") + x.gsub!("%regend%", "<pre>"+regend.chomp+"</pre>") + x.gsub!("%osu%", osu) + x.gsub!("%yu%", yu) + x.gsub!("%add%", add) + x.gsub!("%tel%", tel) + out.print x + end + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ruby/temp.txt Thu Nov 21 16:33:48 2013 +0900 @@ -0,0 +1,26 @@ +<html> +<head> +<title>%sbj%</title> +<link rel="stylesheet" type="text/css" href="%choice%.css"> +</head> + +<body> +<div class="main"> +<p>%time%</p> +<p><img src="%after%"></p> +<h1>%sbj%</h1> +<h2>罩翫</h2> +%history% +<h2>篌茯</h2> +%regend% +<h2>鴻鴻≦</h2> +<p>%osu%</p> +<p>灸梢</p> +<p>%yu%</p> +<p>篏</p> +<p>%add%</p> +<p>肢援<br> +<p>%tel%</p> +</div> +</body> +</html>