view blog.rb @ 2140:bd4cae849b16

ブログ更新
author KAMADA Kei <c110206@f.koeki-u.ac.jp>
date Wed, 23 Oct 2013 15:32:04 +0900
parents ba40fcad753f
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 # nilC-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

yatex.org