Mercurial > hgrepos > hgweb.cgi > skipweb
view archive/blog.rb @ 3888:f1d4d100b863
changed index.html(»³·Á¸©¼òÅĻԢª¾±ÆâÃÏÊý)
author | Fumiya SATO <c116092@h.koeki-u.ac.jp> |
---|---|
date | Mon, 18 Feb 2019 13:35:27 +0900 |
parents | ca7dc3493900 |
children |
line wrap: on
line source
#!/usr/bin/ruby # coding: euc-jp require 'date' day = Date.today STDERR.print "タイトル:" title = gets.chomp comment = "" STDERR.puts "コメントをã©ã†ãž(ピリオドã®ã¿ã®è¡Œã§ãŠã—ã¾ã„)" while true com1 = gets if com1 == ".\n" || com1 == nil then # nilã¯C-dã§å…¥åŠ›çµ‚了ã—ãŸã¨ã break end comment += com1 end STDERR.print "写真をアップãƒãƒ¼ãƒ‰(ç”»åƒãƒ•ã‚¡ã‚¤ãƒ«æŒ‡å®šã€ãªã„ã¨ãã¯Return):" photo = gets.chomp if photo != "" then photo = '<img src="'+photo+'" width="640" height="480">' end STDERR.print "書ã„ãŸäºº:" writer = gets.chomp open("template.txt", "r") do |cm| while x = cm.gets x.gsub!("%day%", day.to_s) x.gsub!("%title%", title) x.gsub!("%comment%", "<p>"+comment.chomp+"</p>") x.gsub!("%photo%", photo) x.gsub!("%writer%", writer) print x end end