#! /usr/bin/env ruby # coding: utf-8 # # 設定は ~/.diary.yaml に書かれる。 # 一部コマンドラインオプションで与えることができるが、 # その場合はコマンドラインオプションで指定した値を優先する。 # # options # -n date : the last day in latest.html. e.g., -n 2011/10/1 . # Default value is the present day. # -d days : the number of date included in latest.html. e.g., -d 30 . # Default value is 60. SOURCE = "/home/ippei/doc/website/ur/diary" TARGET = "/home/ippei/doc/website/ur/diary" DAYS = 60 SITE_NAME = "水上都市ウル" DIARY_TITLE = "きづき(日記):最新" DIARY_PREFACE = "
[トップページへ]\n" FOOTER = "
\n 最新日記の各日付が当該月の日記へのリンクになっています。\n さらに過去のものはトップページから辿れます。\n
\n | トップページ |\n" require "optparse" require "yaml" require "pp" require "date" require "time" require "array/selectindices.rb" class DiaryLatest def initialize(options) @source_directory = SOURCE @source_files = source_files if @source_files.size == 0 raise "No month diary files in #{options['source']}. Abort." end @site_name = SITE_NAME @diary_title = DIARY_TITLE @diary_preface = DIARY_PREFACE @footer = FOOTER end # Make latest.html. # An argument 'newest_date' indicates the last day in latest.html. # An argument 'days' indicates the number of date included in latest.html. # Scanning all files named /^\d{4}/\d{2}.html$/ like '2011/09.html', def generate(io, days, newest_date = Date.now, now = Time.now) year = now.year month = now.month # head strs = [ "", "", "
", " ", " ", " ", " ", "