Index: index.rb
===================================================================
RCS file: /cvsroot/tdiary/core/index.rb,v
retrieving revision 1.35
diff -u -r1.35 index.rb
--- index.rb	8 Jan 2007 05:55:23 -0000	1.35
+++ index.rb	11 Nov 2007 22:42:57 -0000
@@ -1,4 +1,5 @@
 #!/usr/bin/env ruby
+$:.unshift( "/###" )
 #
 # index.rb $Revision: 1.35 $
 #
@@ -53,7 +54,7 @@
 
 	begin
 		head = {
-			'type' => 'text/html',
+			'type' => tdiary.content_type,
 			'Vary' => 'User-Agent'
 		}
 		head['status'] = status if status
@@ -90,14 +91,14 @@
 	rescue TDiary::ForceRedirect
 		head = {
 			#'Location' => $!.path
-			'type' => 'text/html',
+			'type' => tdiary.content_type,
 		}
 		head['cookie'] = tdiary.cookies if tdiary.cookies.size > 0
 		print @cgi.header( head )
 		print %Q[
-			<html>
+			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
 			<head>
-			<meta http-equiv="refresh" content="1;url=#{$!.path}">
+			<meta http-equiv="refresh" content="1;url=#{$!.path}" />
 			<title>moving...</title>
 			</head>
 			<body>Wait or <a href="#{$!.path}">Click here!</a></body>
Index: tdiary.rb
===================================================================
RCS file: /cvsroot/tdiary/core/tdiary.rb,v
retrieving revision 1.293.2.24
diff -u -r1.293.2.24 tdiary.rb
--- tdiary.rb	13 Oct 2007 18:09:20 -0000	1.293.2.24
+++ tdiary.rb	11 Nov 2007 22:42:59 -0000
@@ -395,7 +395,7 @@
 		end
 
 		def eval_rhtml( opt, path = '.' )
-			ERB::new( File::open( "#{path}/skel/#{opt['prefix']}diary.rhtml" ){|f| f.read }.untaint ).result( binding )
+			ERB::new( File::open( "#{path}/skel/#{opt['prefix']}diary.rhtml" ){|f| f.read }.untaint ).result( binding ).gsub( /<p>\s*<\/p>/im, '' )
 		end
 	end
 
@@ -980,7 +980,7 @@
 		end
 
 		def help( name )
-			%Q[<div class="help-icon"><a href="http://docs.tdiary.org/#{h @conf.lang}/?#{h name}" target="_blank"><img src="#{theme_url}/help.png" width="19" height="19" alt="Help"></a></div>]
+			%Q[<div class="help-icon"><a href="http://docs.tdiary.org/#{h @conf.lang}/?#{h name}"><img src="#{theme_url}/help.png" width="19" height="19" alt="Help" /></a></div>]
 		end
 
 		def method_missing( *m )
@@ -1040,7 +1040,7 @@
 			rescue Exception
 				raise
 			end
-			return r
+			return r.gsub( /<p>\s*<\/p>/im, '' )
 		end
 
 		def restore_parser_cache( date, key )
@@ -1067,6 +1067,15 @@
 			@years = @io.calendar unless @years
 		end
 
+		def content_type
+			if /application\/xhtml\+xml/ =~ ENV['HTTP_ACCEPT']
+				'application/xhtml+xml'
+			else
+				'text/html'
+			end
+			'text/html'
+		end
+
 	protected
 		def do_eval_rhtml( prefix )
 			# load plugin files
@@ -1094,7 +1103,7 @@
 			# apply plugins
 			r = @plugin.eval_src( r.untaint, @conf.secure ) if @plugin
 			@cookies += @plugin.cookies
-			r
+			r.gsub( /<p>\s*<\/p>/im, '' )
 		end
 
 		def mode
Index: update.rb
===================================================================
RCS file: /cvsroot/tdiary/core/update.rb,v
retrieving revision 1.21.2.2
diff -u -r1.21.2.2 update.rb
--- update.rb	12 Apr 2007 00:42:40 -0000	1.21.2.2
+++ update.rb	11 Nov 2007 22:42:59 -0000
@@ -1,4 +1,5 @@
 #!/usr/bin/env ruby
+$:.unshift( "/###" )
 #
 # update.rb $Revision: 1.21.2.2 $
 #
@@ -53,7 +54,7 @@
 			body = conf.to_mobile( tdiary.eval_rhtml( 'i.' ) )
 			head = @cgi.header(
 				'status' => '200 OK',
-				'type' => 'text/html',
+				'type' => tdiary.content_type,
 				'charset' => conf.mobile_encoding,
 				'Content-Length' => body.size.to_s,
 				'Vary' => 'User-Agent'
@@ -62,7 +63,7 @@
 			body = tdiary.eval_rhtml
 			head = @cgi.header(
 				'status' => '200 OK',
-				'type' => 'text/html',
+				'type' => tdiary.content_type,
 				'charset' => conf.encoding,
 				'Content-Length' => body.size.to_s,
 				'Vary' => 'User-Agent'
@@ -73,14 +74,14 @@
 	rescue TDiary::ForceRedirect
 		head = {
 			#'Location' => $!.path
-			'type' => 'text/html',
+			'type' => tdiary.content_type,
 		}
 		head['cookie'] = tdiary.cookies if tdiary.cookies.size > 0
 		print @cgi.header( head )
 		print %Q[
-			<html>
+			<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
 			<head>
-			<meta http-equiv="refresh" content="1;url=#{$!.path}">
+			<meta http-equiv="refresh" content="1;url=#{$!.path}" />
 			<title>moving...</title>
 			</head>
 			<body>Wait or <a href="#{$!.path}">Click here!</a></body>
Index: plugin/00default.rb
===================================================================
RCS file: /cvsroot/tdiary/core/plugin/00default.rb,v
retrieving revision 1.101.2.11
diff -u -r1.101.2.11 00default.rb
--- plugin/00default.rb	13 Oct 2007 18:09:21 -0000	1.101.2.11
+++ plugin/00default.rb	11 Nov 2007 22:42:59 -0000
@@ -160,7 +160,7 @@
 	begin
 		File::readlines( file ).join
 	rescue
-		%Q[<p class="message">#$! (#{h $!.class})<br>cannot read #{h file}.</p>]
+		%Q[<p class="message">#$! (#{h $!.class})<br />cannot read #{h file}.</p>]
 	end
 end
 
@@ -168,7 +168,7 @@
 # define DOCTYPE
 #
 def doctype
-	%Q[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">]
+	%Q[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "ttp://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">]
 end
 
 #
@@ -177,8 +177,8 @@
 add_header_proc do
 	calc_links
 	<<-HEADER
-	<meta http-equiv="Content-Type" content="text/html; charset=#{h charset}">
-	<meta name="generator" content="tDiary #{h TDIARY_VERSION}">
+	<meta http-equiv="Content-Type" content="#{h content_type}; charset=#{h charset}" />
+	<meta name="generator" content="tDiary #{h TDIARY_VERSION}" />
 	#{last_modified_header}
 	#{content_script_type}
 	#{author_name_tag}
@@ -252,6 +252,15 @@
 	end
 end
 
+def content_type
+	if /application\/xhtml\+xml/ =~ ENV['HTTP_ACCEPT']
+		'application/xhtml+xml'
+	else
+		'text/html'
+	end
+	'text/html'
+end
+
 def charset
 	if @conf.mobile_agent? then
 		@conf.mobile_encoding
@@ -262,19 +271,19 @@
 
 def last_modified_header
 	if @last_modified then
-		%Q|<meta http-equiv="Last-Modified" content="#{CGI::rfc1123_date( @last_modified )}">|
+		%Q|<meta http-equiv="Last-Modified" content="#{CGI::rfc1123_date( @last_modified )}" />|
 	else
 		''
 	end
 end
 
 def content_script_type
-	%Q[<meta http-equiv="Content-Script-Type" content="text/javascript; charset=#{h charset}">]
+	%Q[<meta http-equiv="Content-Script-Type" content="text/javascript; charset=#{h charset}" />]
 end
 
 def author_name_tag
 	if @author_name and not(@author_name.empty?) then
-		%Q[<meta name="author" content="#{h @author_name}">]
+		%Q[<meta name="author" content="#{h @author_name}" />]
 	else
 		''
 	end
@@ -282,7 +291,7 @@
 
 def author_mail_tag
 	if @author_mail and not(@author_mail.empty?) then
-		%Q[<link rev="made" href="mailto:#{h @author_mail}">]
+		%Q[<link rev="made" href="mailto:#{h @author_mail}" />]
 	else
 		''
 	end
@@ -291,25 +300,25 @@
 def index_page_tag
 	result = ''
 	if @index_page and @index_page.size > 0 then
-		result << %Q[<link rel="index" title="#{h navi_index}" href="#{h @index_page}">\n\t]
+		result << %Q[<link rel="index" title="#{h navi_index}" href="#{h @index_page}" />\n\t]
 	end
 	if @prev_day then
 		case @mode
 		when 'day'
-			result << %Q[<link rel="prev" title="#{navi_prev_diary( Time::local(*@prev_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @prev_day}">\n\t]
+			result << %Q[<link rel="prev" title="#{navi_prev_diary( Time::local(*@prev_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @prev_day}" />\n\t]
 		when 'nyear'
-			result << %Q[<link rel="prev" title="#{navi_prev_nyear( Time::local(*@prev_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @prev_day[4,4]}">\n\t]
+			result << %Q[<link rel="prev" title="#{navi_prev_nyear( Time::local(*@prev_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @prev_day[4,4]}" />\n\t]
 		end
 	end
 	if @next_day then
 		case @mode
 		when 'day'
-			result << %Q[<link rel="next" title="#{navi_next_diary( Time::local(*@next_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @next_day}">\n\t]
+			result << %Q[<link rel="next" title="#{navi_next_diary( Time::local(*@next_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @next_day}" />\n\t]
 		when 'nyear'
-			result << %Q[<link rel="next" title="#{h navi_next_nyear( Time::local(*@next_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @next_day[4,4]}">\n\t]
+			result << %Q[<link rel="next" title="#{h navi_next_nyear( Time::local(*@next_day.scan(/^(\d{4})(\d\d)(\d\d)$/)[0]) )}" href="#{h @index}#{anchor @next_day[4,4]}" />\n\t]
 		end
 	end
-	result << %Q[<link rel="start" title="#{navi_latest}" href="#{h @index}">\n\t]
+	result << %Q[<link rel="start" title="#{navi_latest}" href="#{h @index}" />\n\t]
 	result.chop.chop
 end
 
@@ -321,15 +330,15 @@
 	if @mode == 'day' then
 		uri += anchor( @date.strftime( '%Y%m%d' ) )
 	end
-	%Q[<link rel="alternate" media="handheld" type="text/html" href="#{h uri}">]
+	%Q[<link rel="alternate" media="handheld" type="text/html" href="#{h uri}" />]
 end
 
 def icon_tag
 	if @conf.icon and not(@conf.icon.empty?) then
 		if /\.ico$/ =~ @conf.icon then
-			%Q[<link rel="shortcut icon" href="#{h @conf.icon}">]
+			%Q[<link rel="shortcut icon" href="#{h @conf.icon}" />]
 		else
-			%Q[<link rel="icon" href="#{h @conf.icon}">]
+			%Q[<link rel="icon" href="#{h @conf.icon}" />]
 		end
 	else
 		''
@@ -338,7 +347,7 @@
 
 def description_tag
 	if @conf.description and not(@conf.description.empty?) then
-		%Q[<meta name="description" content="#{h @conf.description}">]
+		%Q[<meta name="description" content="#{h @conf.description}" />]
 	else
 		''
 	end
@@ -356,15 +365,15 @@
 	end
 	title = File::basename( css, '.css' )
 	<<-CSS
-<meta http-equiv="content-style-type" content="text/css">
-	<link rel="stylesheet" href="#{h theme_url}/base.css" type="text/css" media="all">
-	<link rel="stylesheet" href="#{h css}" title="#{h title}" type="text/css" media="all">
+<meta http-equiv="content-style-type" content="text/css" />
+	<link rel="stylesheet" href="#{h theme_url}/base.css" type="text/css" media="all" />
+	<link rel="stylesheet" href="#{h css}" title="#{h title}" type="text/css" media="all" />
 	CSS
 end
 
 def robot_control
 	if /^form|edit|preview|showcomment$/ =~ @mode then
-		'<meta name="robots" content="noindex,nofollow">'
+		'<meta name="robots" content="noindex,nofollow" />'
 	else
 		''
 	end
@@ -456,7 +465,7 @@
 	else
 		if date then
 			r << "<a "
-			r << %Q[name="p#{'%02d' % index}" ] if @anchor_name
+			r << %Q[id="p#{'%02d' % index}" ] if @anchor_name
 			param = "#{date.strftime( '%Y%m%d' )}#p#{'%02d' % index}"
 			r << %Q[href="#{h @index}#{anchor param}">#{@conf.section_anchor}</a> ]
 		end
@@ -523,24 +532,24 @@
 		FORM
 		if @diaries[@date.strftime('%Y%m%d')].count_comments( true ) >= @conf.comment_limit_per_day then
 			r << <<-FORM
-				<div class="caption"><a name="c">#{comment_limit_label}</a></div>
+				<div class="caption"><a id="c">#{comment_limit_label}</a></div>
 			FORM
 		else
 			r << <<-FORM
-					<div class="caption"><a name="c">#{comment_description}</a></div>
-					<form class="comment" name="comment-form" method="post" action="#{h @index}"><div>
-					<input type="hidden" name="date" value="#{ @date.strftime( '%Y%m%d' )}">
+					<div class="caption"><a id="c">#{comment_description}</a></div>
+					<form class="comment" id="comment-form" method="post" action="#{h @index}"><div>
+					<input type="hidden" name="date" value="#{ @date.strftime( '%Y%m%d' )}" />
 					<div class="field name">
-						#{comment_name_label}:<input class="field" name="name" value="#{h( @conf.to_native(@cgi.cookies['tdiary'][0] || '' ))}">
-					</div>
-					<div class="field mail">
-						#{comment_mail_label}:<input class="field" name="mail" value="#{h( @cgi.cookies['tdiary'][1] || '' )}">
+						#{comment_name_label}:<input class="field" name="name" value="#{h( @conf.to_native(@cgi.cookies['tdiary'][0] || '' ))}" />
 					</div>
+					<!-- div class="field mail">
+						#{comment_mail_label}:<input class="field" name="mail" value="#{h( @cgi.cookies['tdiary'][1] || '' )}" />
+					</div -->
 					<div class="textarea">
 						#{comment_body_label}:<textarea name="body" cols="60" rows="5"></textarea>
 					</div>
 					<div class="button">
-						<input type="submit" name="comment" value="#{h comment_submit_label}">
+						<input type="submit" name="comment" value="#{h comment_submit_label}" />
 					</div>
 					</div></form>
 			FORM
@@ -707,7 +716,7 @@
 	</select>
 	<input name="css" size="50" value="#{h @conf.css}">
 	</p>
-	<p><img id="theme_thumbnail" src="http://www.tdiary.org/theme.image/#{img}.jpg" alt="#{@theme_thumbnail_label}"></p>
+	<p><img id="theme_thumbnail" src="http://www.tdiary.org/theme.image/#{img}.jpg" alt="#{@theme_thumbnail_label}" /></p>
 	<script language="JavaScript"><!--
 		function changeTheme( image, list ) {
 			var theme = '';
Index: plugin/ja/00default.rb
===================================================================
RCS file: /cvsroot/tdiary/core/plugin/ja/00default.rb,v
retrieving revision 1.23.2.4
diff -u -r1.23.2.4 00default.rb
--- plugin/ja/00default.rb	13 Oct 2007 18:09:24 -0000	1.23.2.4
+++ plugin/ja/00default.rb	11 Nov 2007 22:43:00 -0000
@@ -63,10 +63,10 @@
 	<p><textarea name="comment_mail.receivers" cols="40" rows="3">#{h( @conf['comment_mail.receivers'].gsub( /[, ]+/, "\n") )}</textarea></p>
 	<h3 class="subtitle">メールヘッダ</h3>
 	#{"<p>メールのSubjectにつけるヘッダ文字列を指定します。振り分け等に便利なように指定します。実際のSubjectには「指定文字列:日付-1」のように、日付とコメント番号が付きます。ただし指定文字列中に、%に続く英字があった場合、それを日付フォーマット指定を見なします。つまり「日付」の部分は自動的に付加されなくなります(コメント番号は付加されます)。</p>" unless @conf.mobile_agent?}
-	<p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}"></p>
+	<p><input name="comment_mail.header" value="#{h @conf['comment_mail.header']}" /></p>
 	<h3 class="subtitle">非表示ツッコミの扱い</h3>
 	#{"<p>フィルタの結果、最初から非表示にされたツッコミが記録されることがあります。この非表示のツッコミが来たときにもメールを発信するかどうかを選択します。</p>" unless @conf.mobile_agent?}
-	<p><label for="comment_mail.sendhidden"><input type="checkbox" id="comment_mail.sendhidden" name="comment_mail.sendhidden" value="true"#{" checked" if @conf['comment_mail.sendhidden']}>非表示のツッコミでもメールを送る</label></p>
+	<p><label for="comment_mail.sendhidden"><input type="checkbox" id="comment_mail.sendhidden" name="comment_mail.sendhidden" value="true"#{" checked" if @conf['comment_mail.sendhidden']} />非表示のツッコミでもメールを送る</label></p>
 	HTML
 end
 
@@ -123,8 +123,8 @@
 end
 def preview_label; 'プレビュー'; end
 
-def nyear_diary_label(date, years); "長年日記"; end
-def nyear_diary_title(date, years); "長年日記"; end
+def nyear_diary_label(date, years); "昔の今日"; end
+def nyear_diary_title(date, years); "昔の今日"; end
 
 #
 # labels (for mobile)
@@ -164,36 +164,36 @@
 	<<-HTML
 	<h3 class="subtitle">タイトル</h3>
 	#{"<p>HTMLの&lt;title&gt;タグ中および、モバイル端末からの参照時に使われるタイトルです。HTMLタグは使えません。</p>" unless @conf.mobile_agent?}
-	<p><input name="html_title" value="#{h @conf.html_title}" size="50"></p>
+	<p><input name="html_title" value="#{h @conf.html_title}" size="50" /></p>
 
 	<h3 class="subtitle">著者名</h3>
 	#{"<p>あなたの名前を指定します。HTMLヘッダ中に展開されます。</p>" unless @conf.mobile_agent?}
-	<p><input name="author_name" value="#{h @conf.author_name}" size="40"></p>
+	<p><input name="author_name" value="#{h @conf.author_name}" size="40" /></p>
 
 	<h3 class="subtitle">メールアドレス</h3>
 	#{"<p>あなたのメールアドレスを指定します。HTMLヘッダ中に展開されます。</p>" unless @conf.mobile_agent?}
-	<p><input name="author_mail" value="#{h @conf.author_mail}" size="40"></p>
+	<p><input name="author_mail" value="#{h @conf.author_mail}" size="40" /></p>
 
 	<h3 class="subtitle">トップページURL</h3>
 	#{"<p>日記よりも上位のコンテンツがあれば指定します。存在しない場合は何も入力しなくてかまいません。</p>" unless @conf.mobile_agent?}
-	<p><input name="index_page" value="#{h @conf.index_page}" size="70"></p>
+	<p><input name="index_page" value="#{h @conf.index_page}" size="70" /></p>
 
 	<h3 class="subtitle">日記のURL</h3>
 	#{"<p>日記のURLを指定します。このURLは、さまざまなプラグインで日記の指し示すために利用されるので、正しく一意なものを指定しましょう。</p>" unless @conf.mobile_agent?}
 	#{"<p><strong>指定してある値と、現在アクセス中のURLが異なります。注意してください。</strong></p>" unless @conf.base_url == @conf.base_url_auto}
-	<p><input name="base_url" value="#{h @conf.base_url}" size="70"></p>
+	<p><input name="base_url" value="#{h @conf.base_url}" size="70" /></p>
 
 	<h3 class="subtitle">日記の説明</h3>
 	#{"<p>この日記の簡単な説明を指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>" unless @conf.mobile_agent?}
-	<p><input name="description" value="#{h @conf.description}" size="70"></p>
+	<p><input name="description" value="#{h @conf.description}" size="70" /></p>
 
 	<h3 class="subtitle">サイトアイコン(favicon)</h3>
 	#{"<p>この日記を表す小さなアイコン画像(favicon)があればそのURLを指定します。HTMLヘッダ中に展開されます。何も入力しなくてもかまいません。</p>" unless @conf.mobile_agent?}
-	<p><input name="icon" value="#{h @conf.icon}" size="70"></p>
+	<p><input name="icon" value="#{h @conf.icon}" size="70" /></p>
 
 	<h3 class="subtitle">バナー画像</h3>
 	#{"<p>この日記を表す画像(バナー)があればそのURLを指定します。makerssプラグインなどでRSSを出力する場合などに使われます。何も入力しなくてもかまいません。</p>" unless @conf.mobile_agent?}
-	<p><input name="banner" value="#{h @conf.banner}" size="70"></p>
+	<p><input name="banner" value="#{h @conf.banner}" size="70" /></p>
 	HTML
 end
 
@@ -216,16 +216,16 @@
 	<<-HTML
 	<h3 class="subtitle">セクションアンカー</h3>
 	#{"<p>日記のセクションの先頭(サブタイトルの行頭)に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class=\"sanchor\"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @conf.mobile_agent?}
-	<p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40"></p>
+	<p><input name="section_anchor" value="#{h @conf.section_anchor}" size="40" /></p>
 	<h3 class="subtitle">ツッコミアンカー</h3>
 	#{"<p>読者からのツッコミの先頭に挿入される、リンク用のアンカー文字列を指定します。なお「&lt;span class=\"canchor\"&gt;_&lt;/span&gt;」を指定すると、テーマによっては自動的に画像アンカーがつくようになります。</p>" unless @conf.mobile_agent?}
-	<p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40"></p>
+	<p><input name="comment_anchor" value="#{h @conf.comment_anchor}" size="40" /></p>
 	<h3 class="subtitle">日付フォーマット</h3>
 	#{"<p>日付の表示部分に使われるフォーマットを指定します。任意の文字が使えますが、「%」で始まる英字には次のような特殊な意味があります。「%Y」(西暦年)、「%m」(月数値)、「%b」(短月名)、「%B」(長月名)、「%d」(日)、「%a」(短曜日名)、「%A」(長曜日名)。</p>" unless @conf.mobile_agent?}
-	<p><input name="date_format" value="#{h @conf.date_format}" size="30"></p>
+	<p><input name="date_format" value="#{h @conf.date_format}" size="30" /></p>
 	<h3 class="subtitle">最新表示の最大日数</h3>
 	#{"<p>最新の日記を表示するときに、そのページ内に何日分の日記を表示するかを指定します。</p>" unless @conf.mobile_agent?}
-	<p>最大<input name="latest_limit" value="#{h @conf.latest_limit}" size="2">日分</p>
+	<p>最大<input name="latest_limit" value="#{h @conf.latest_limit}" size="2" />日分</p>
 	<h3 class="subtitle">長年日記の表示</h3>
 	#{"<p>長年日記を表示するためのリンクを表示するかどうかを指定します。</p>" unless @conf.mobile_agent?}
 	<p><select name="show_nyear">
@@ -241,7 +241,7 @@
 	<<-HTML
 	<h3 class="subtitle">時差調整</h3>
 	#{"<p>更新時、フォームに挿入される日付を時間単位で調整できます。例えば午前2時までは前日として扱いたい場合には「-2」のように指定することで、2時間分引かれた日付が挿入されるようになります。また、この日付はWebサーバ上の時刻になっているので、海外のサーバで運営している場合の時差調整にも利用できます。</p>" unless @conf.mobile_agent?}
-	<p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5"></p>
+	<p><input name="hour_offset" value="#{h @conf.hour_offset}" size="5" /></p>
 	HTML
 end
 
@@ -273,10 +273,10 @@
 	</select></p>
 	<h3 class="subtitle">ツッコミリスト表示数</h3>
 	#{"<p>最新もしくは月別表示時に表示する、ツッコミの最大件数を指定します。なお、日別表示時にはここの指定にかかわらずすべてのツッコミが表示されます。</p>" unless @conf.mobile_agent?}
-	<p>最大<input name="comment_limit" value="#{h @conf.comment_limit}" size="3">件</p>
+	<p>最大<input name="comment_limit" value="#{h @conf.comment_limit}" size="3" />件</p>
 	<h3 class="subtitle">1日あたりのツッコミ最大数</h3>
 	#{"<p>1日に書き込めるツッコミの最大数を指定します。この数を超えると、ツッコミ用のフォームが非表示になります。なお、TrackBackプラグインを入れている場合には、ツッコミとTrackBackの合計がこの制限を受けます。</p>" unless @conf.mobile_agent?}
-	<p>最大<input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3">件</p>
+	<p>最大<input name="comment_limit_per_day" value="#{h @conf.comment_limit_per_day}" size="3" />件</p>
 	HTML
 end
 
@@ -304,8 +304,8 @@
 	<h3 class="subtitle">Refererチェックによる防衛</h3>
 	<h4>Refererの正当性の検査</h4>
 	<p>#{if [0,1,2,3].include?(csrf_protection_method) then
-            '<input type="checkbox" name="check_enabled2" value="true" checked disabled>
-            <input type="hidden" name="check_enabled" value="true">'
+            '<input type="checkbox" name="check_enabled2" value="true" checked disabled />
+            <input type="hidden" name="check_enabled" value="true" />'
           else
             '<input type="checkbox" name="check_enabled" value="true">'
         end}する(標準)</input>
Index: skel/category.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/category.rhtml,v
retrieving revision 1.8
diff -u -r1.8 category.rhtml
--- skel/category.rhtml	6 Jan 2007 14:20:35 -0000	1.8
+++ skel/category.rhtml	11 Nov 2007 22:43:00 -0000
@@ -3,8 +3,8 @@
 <%=@conf['category.header1'] %>
 <h1><%=h @conf.html_title %> <%%=h category_title %></h1>
 <%= @conf['category.header2'] %>
-<hr class="sep">
+<hr class="sep" />
 <%%= category_list_sections %>
-<hr class="sep">
+<hr class="sep" />
 <%%= category_form %>
-<hr class="sep">
+<hr class="sep" />
Index: skel/conf.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/conf.rhtml,v
retrieving revision 1.30
diff -u -r1.30 conf.rhtml
--- skel/conf.rhtml	6 Jan 2007 14:20:35 -0000	1.30
+++ skel/conf.rhtml	11 Nov 2007 22:43:00 -0000
@@ -12,9 +12,9 @@
 	<%% end %>
 </div>
 <form class="conf" method="post" action="<%=h @conf.update %>"><div>
-	<input type="hidden" name="conf" value="<%=h @key%>">
+	<input type="hidden" name="conf" value="<%=h @key%>" />
 	<%=@csrf_protection%>
 	<%%=help( <%=@key.dump%> + '.rb' )%>
 	<%%=conf_proc( <%=@key.dump%> )%>
-	<div class="saveconf"><input class="saveconf" type="submit" name="saveconf" value="OK"></div>
+	<div class="saveconf"><input class="saveconf" type="submit" name="saveconf" value="OK" /></div>
 </div></form>
Index: skel/day.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/day.rhtml,v
retrieving revision 1.10
diff -u -r1.10 day.rhtml
--- skel/day.rhtml	17 Mar 2006 14:48:49 -0000	1.10
+++ skel/day.rhtml	11 Nov 2007 22:43:00 -0000
@@ -1,6 +1,6 @@
 <%# day.rhtml $Revision: 1.10 $ %>
 <%= @conf.header %>
-<hr class="sep">
+<hr class="sep" />
 
 <%
 if @diary then
@@ -29,6 +29,6 @@
 	<%%=no_diary%>
 	</p><%
 end %>
-<hr class="sep">
+<hr class="sep" />
 
 <%= @conf.footer %>
Index: skel/diary.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/diary.rhtml,v
retrieving revision 1.27
diff -u -r1.27 diary.rhtml
--- skel/diary.rhtml	6 Jan 2007 14:20:35 -0000	1.27
+++ skel/diary.rhtml	11 Nov 2007 22:43:00 -0000
@@ -12,19 +12,19 @@
 <%
 if opt['show_comment'] and count_comments > 0 then
 	if opt['long_mode'] then %>
-		<div class="caption"><%%=comment_today%><%%=comment_total( <%=count_comments%> )%> [<a name="c00" href="<%=h opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c" %>"><%%=comment_new%></a>]</div>
+		<div class="caption"><%%=comment_today%><%%=comment_total( <%=count_comments%> )%> [<a id="c00" href="<%=h opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c" %>"><%%=comment_new%></a>]</div>
 		<div class="commentbody"><%
 		each_visible_comment( opt['comment_limit'] ) do |comment,idx|
 			if comment.visible? %>
 				<div class="commentator">
-					<a <% if opt['anchor'] then %>name="c<%= '%02d' % idx %>" <% end %>href="<%=h opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c<%= '%02d' % idx %>" %>"><%= opt['comment_anchor'] %></a>
+					<a <% if opt['anchor'] then %>id="c<%= '%02d' % idx %>" <% end %>href="<%=h opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c<%= '%02d' % idx %>" %>"><%= opt['comment_anchor'] %></a>
 					<span class="commentator"><%=h comment.name %></span>
 					<span class="commenttime"><%%=comment_date( Time::at( <%=comment.date.to_i%> ) )%></span>
 				</div>
 				<p><% if opt['bot'] then %>
-					<%=h comment.body.gsub( /\n/ , "<br>" ).gsub( /<br><br>\Z/, '' ) %>
+					<%=h comment.body.gsub( /\n/ , "<br />" ).gsub( /<br \/><br \/>\Z/, '' ) %>
 				<% else %>
-					<%= comment.body.make_link.gsub( /\n/ , "<br>" ).gsub( /<br><br>\Z/, '' ) %>
+					<%= comment.body.make_link.gsub( /\n/ , "<br />" ).gsub( /<br \/><br \/>\Z/, '' ) %>
 				<% end %></p><%
 			end
 		end %>
Index: skel/footer.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/footer.rhtml,v
retrieving revision 1.8
diff -u -r1.8 footer.rhtml
--- skel/footer.rhtml	6 Jan 2007 14:20:35 -0000	1.8
+++ skel/footer.rhtml	11 Nov 2007 22:43:00 -0000
@@ -1,7 +1,7 @@
 <%# footer.rhtml $Revision: 1.8 $ %>
 <%%=footer_proc%>
 <div class="footer">
-Generated by <a href="http://www.tdiary.org/">tDiary</a> version <%=h TDIARY_VERSION %><br>
+Generated by <a href="http://www.tdiary.org/">tDiary</a> version <%=h TDIARY_VERSION %><br />
 Powered by <a href="http://www.ruby-lang.org/">Ruby</a> version <%=h RUBY_VERSION %><% if /ruby/i =~ @cgi.gateway_interface %> with <a href="http://www.modruby.net/">mod_ruby</a><% end %>
 </div>
 </body>
Index: skel/header.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/header.rhtml,v
retrieving revision 1.7
diff -u -r1.7 header.rhtml
--- skel/header.rhtml	6 Jan 2007 14:20:35 -0000	1.7
+++ skel/header.rhtml	11 Nov 2007 22:43:00 -0000
@@ -1,9 +1,9 @@
 <%%=doctype%><%# header.rhtml $Revision: 1.7 $ %>
-<html lang="<%%=h @conf.html_lang%>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%%=h @conf.html_lang%>">
 <head>
 <%%=header_proc%>
 </head>
 <body>
-<% if @error then %><p class="message">Security Error?<br>
-<%=h @error[0].to_s %><br><%=h @error[1][0] %>
+<% if @error then %><p class="message">Security Error?<br />
+<%=h @error[0].to_s %><br /><%=h @error[1][0] %>
 </p><% end %>
Index: skel/latest.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/latest.rhtml,v
retrieving revision 1.5
diff -u -r1.5 latest.rhtml
--- skel/latest.rhtml	25 Sep 2003 02:15:51 -0000	1.5
+++ skel/latest.rhtml	11 Nov 2007 22:43:00 -0000
@@ -1,6 +1,6 @@
 <%# latest.rhtml $Revision: 1.5 $ %>
 <%= @conf.header %>
-<hr class="sep">
+<hr class="sep" />
 
 <%
 param = {
@@ -20,7 +20,7 @@
 }
 latest( @conf.latest_limit ) do |diary| %>
 	<%= diary.eval_rhtml( param, PATH ) %>
-	<hr class="sep"><%
+	<hr class="sep" /><%
 end %>
 
 <%= @conf.footer %>
Index: skel/month.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/month.rhtml,v
retrieving revision 1.5
diff -u -r1.5 month.rhtml
--- skel/month.rhtml	25 Sep 2003 02:15:51 -0000	1.5
+++ skel/month.rhtml	11 Nov 2007 22:43:00 -0000
@@ -1,6 +1,6 @@
 <%# month.rhtml $Revision: 1.5 $ %>
 <%= @conf.header %>
-<hr class="sep">
+<hr class="sep" />
 
 <%
 param = {
@@ -20,7 +20,7 @@
 }
 each_day do |diary| %>
 	<%= diary.eval_rhtml( param, PATH ) %>
-	<hr class="sep"><%
+	<hr class="sep" /><%
 end %>
 
 <%= @conf.footer %>
Index: skel/plugin_error.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/plugin_error.rhtml,v
retrieving revision 1.8
diff -u -r1.8 plugin_error.rhtml
--- skel/plugin_error.rhtml	8 Jan 2007 03:52:05 -0000	1.8
+++ skel/plugin_error.rhtml	11 Nov 2007 22:43:00 -0000
@@ -1,7 +1,7 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
-	<meta name="generator" content="<%=h TDIARY_VERSION %>">
+	<meta name="generator" content="<%=h TDIARY_VERSION %>" />
 	<title>Plugin Error</title>
 </head>
 <body>
@@ -18,7 +18,7 @@
 	Retry to <%= update %> or <a href="<%=h @conf.update %>?conf=default">Configure</a>.
 </strong></p>
 <blockquote>
-	<strong><%=h $!.class %></strong><br>
+	<p><strong><%=h $!.class %></strong><br /></p>
 	<pre><%=h $! %></pre>
 </blockquote>
 </body>
Index: skel/preview.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/preview.rhtml,v
retrieving revision 1.13.2.2
diff -u -r1.13.2.2 preview.rhtml
--- skel/preview.rhtml	26 Jan 2007 11:08:26 -0000	1.13.2.2
+++ skel/preview.rhtml	11 Nov 2007 22:43:00 -0000
@@ -33,41 +33,41 @@
 	</div>
 <% end %>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="update day">
 <h2><span class="title">更新フォーム</span></h2>
 <div class="form">
 	<form class="update" method="post" action="<%=h @conf.update %>"><div>
-		<input type="hidden" name="old" value="<%=h @old_date %>">
+		<input type="hidden" name="old" value="<%=h @old_date %>" />
 		<%=@csrf_protection%>
 		<span class="field year">
-			<input type="hidden" name="year" value="<%= @date.year %>"><%= @date.year %>年
+			<input type="hidden" name="year" value="<%= @date.year %>" /><%= @date.year %>年
 		</span>
 		<span class="field month">
-			<input type="hidden" name="month" value="<%= @date.mon %>"><%= @date.mon %>月
+			<input type="hidden" name="month" value="<%= @date.mon %>" /><%= @date.mon %>月
 		</span>
 		<span class="field day">
-			<input type="hidden" name="day" value="<%= @date.day %>"><%= @date.day %>日
+			<input type="hidden" name="day" value="<%= @date.day %>" /><%= @date.day %>日
 		</span>
 		<div class="field title">
-			タイトル: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>">
+			タイトル: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>" />
 		</div>
 		<div class="textarea">
 			本文(<%=h @conf.style %>スタイル<%%= style_howto %>):<textarea name="body" tabindex="6" accesskey="C" cols="70" rows="15"><%=h @diary.to_src %></textarea>
 		</div>
 		<%%=edit_proc( @date )%>
 		<span class="button preview">
-			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>">
+			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>" />
 		</span>
 		<span class="button append">
-			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> ">
+			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> " />
 		</span>
 		<span class="checkbox hidediary">
-			この日の日記を隠す<input type="checkbox" name="hide" value="true" <% unless @diary.visible? then %>checked <% end %>tabindex="1000" accesskey="H">
+			この日の日記を隠す<input type="checkbox" name="hide" value="true" <% unless @diary.visible? then %>checked="checked" <% end %>tabindex="1000" accesskey="H" />
 		</span>
 	</div></form>
 </div>
 </div>
 
-<hr class="sep">
+<hr class="sep" />
Index: skel/preview.rhtml.en
===================================================================
RCS file: /cvsroot/tdiary/core/skel/preview.rhtml.en,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 preview.rhtml.en
--- skel/preview.rhtml.en	26 Jan 2007 11:08:26 -0000	1.12.2.1
+++ skel/preview.rhtml.en	11 Nov 2007 22:43:00 -0000
@@ -33,7 +33,7 @@
 	</div>
 <% end %>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="update day">
 <h2><span class="title">Updating Form</span></h2>
@@ -70,4 +70,4 @@
 </div>
 </div>
 
-<hr class="sep">
+<hr class="sep" />
Index: skel/preview.rhtml.zh
===================================================================
RCS file: /cvsroot/tdiary/core/skel/preview.rhtml.zh,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 preview.rhtml.zh
--- skel/preview.rhtml.zh	26 Jan 2007 11:08:26 -0000	1.4.2.2
+++ skel/preview.rhtml.zh	11 Nov 2007 22:43:01 -0000
@@ -40,34 +40,34 @@
 <div class="form">
 	<form class="update" method="post" action="<%=h @conf.update %>"><div>
 		<%=@csrf_protection%>
-		<input type="hidden" name="old" value="<%=h @old_date %>">
+		<input type="hidden" name="old" value="<%=h @old_date %>" />
 		<span class="field year">
-			<input type="hidden" name="year" value="<%= @date.year %>"><%= @date.year %>-
+			<input type="hidden" name="year" value="<%= @date.year %>" /><%= @date.year %>-
 		</span>
 		<span class="field month">
-			<input type="hidden" name="month" value="<%= @date.mon %>"><%= @date.mon %>-
+			<input type="hidden" name="month" value="<%= @date.mon %>" /><%= @date.mon %>-
 		</span>
 		<span class="field day">
-			<input type="hidden" name="day" value="<%= @date.day %>"><%= @date.day %>
+			<input type="hidden" name="day" value="<%= @date.day %>" /><%= @date.day %>
 		</span>
 		<div class="field title">
-			標題: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>">
+			標題: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>" />
 		</div>
 		<div class="textarea">
 			內容(<%=h @conf.style %> style<%%= style_howto %>):<textarea name="body" tabindex="6" accesskey="C" cols="70" rows="15"><%=h @diary.to_src %></textarea>
 		</div>
 		<%%=edit_proc( @date )%>
 		<span class="button preview">
-			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>">
+			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>" />
 		</span>
 		<span class="button append">
-			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> ">
+			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> " />
 		</span>
 		<span class="checkbox hidediary">
-			不要刊出這天的日誌(隱藏)<input type="checkbox" name="hide" value="true" <% unless @diary.visible? then %>checked <% end %>tabindex="1000" accesskey="H">
+			不要刊出這天的日誌(隱藏)<input type="checkbox" name="hide" value="true" <% unless @diary.visible? then %>checked="checked" <% end %>tabindex="1000" accesskey="H" />
 		</span>
 	</div></form>
 </div>
 </div>
 
-<hr class="sep">
+<hr class="sep" />
Index: skel/update.rhtml
===================================================================
RCS file: /cvsroot/tdiary/core/skel/update.rhtml,v
retrieving revision 1.30.2.2
diff -u -r1.30.2.2 update.rhtml
--- skel/update.rhtml	4 May 2007 04:07:20 -0000	1.30.2.2
+++ skel/update.rhtml	11 Nov 2007 22:43:01 -0000
@@ -10,72 +10,72 @@
 	</div>
 	<form class="update" method="post" action="<%=h @conf.update %>"><div>
 		<h3 class="subtitle">日記本文</h3>
-		<input type="hidden" name="old" value="<%= @date.strftime( '%Y%m%d' ) %>">
+		<input type="hidden" name="old" value="<%= @date.strftime( '%Y%m%d' ) %>" />
 		<%=@csrf_protection%>
 		<span class="field year">
-			<input class="field" name="year" tabindex="1" accesskey="Y" size="4" value="<%= @date.year %>">年
+			<input class="field" name="year" tabindex="1" accesskey="Y" size="4" value="<%= @date.year %>" />年
 		</span>
 		<span class="field month">
-			<input class="field" name="month" tabindex="2" accesskey="M" size="2" value="<%= @date.mon %>">月
+			<input class="field" name="month" tabindex="2" accesskey="M" size="2" value="<%= @date.mon %>" />月
 		</span>
 		<span class="field day">
-			<input class="field" name="day" tabindex="3" accesskey="D" size="2" value="<%= @date.day %>">日
+			<input class="field" name="day" tabindex="3" accesskey="D" size="2" value="<%= @date.day %>" />日
 		</span>
 		<span class="button edit">
-			<input type="submit" tabindex="4" accesskey="E" name="edit" value="この日付の日記を編集">
+			<input type="submit" tabindex="4" accesskey="E" name="edit" value="この日付の日記を編集" />
 		</span>
 		<div class="field title">
-			タイトル: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>">
+			タイトル: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>" />
 		</div>
 		<div class="textarea">
 			本文(<%=h @conf.style %>スタイル<%%= style_howto %>):<textarea name="body" tabindex="6" accesskey="C" cols="70" rows="15"><%=h @diary.to_src %></textarea>
 		</div>
 		<%%=edit_proc( @date )%>
 		<span class="button preview">
-			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>">
+			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>" />
 		</span>
 		<span class="button append">
-			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> ">
+			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> " />
 		</span>
 		<span class="checkbox hidediary"><label for="hide">
-			<input type="checkbox" id="hide" name="hide" value="true" <% unless @diary.visible? then %>checked <% end %>tabindex="1000" accesskey="H">この日の日記を隠す
+			<input type="checkbox" id="hide" name="hide" value="true" <% unless @diary.visible? then %>checked="checked" <% end %>tabindex="1000" accesskey="H" />この日の日記を隠す
 		</label></span>
 	</div></form>
 </div>
 
 <%%=form_proc( @date )%>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="comment">
 	<div class="caption"><%%=comment_today%></div>
 	<form class="commentstat" method="post" action="<%=h @conf.update %>"><div>
-		<input type="hidden" name="year" value="<%= @date.year %>">
-		<input type="hidden" name="month" value="<%= @date.month %>">
-		<input type="hidden" name="day" value="<%= @date.day %>">
+		<input type="hidden" name="year" value="<%= @date.year %>" />
+		<input type="hidden" name="month" value="<%= @date.month %>" />
+		<input type="hidden" name="day" value="<%= @date.day %>" />
 		<%=@csrf_protection%>
 		<div class="commentbody"><%
 		idx = 0
 		@diary.each_comment do |comment| %>
 			<div class="commentator">
 				<span class="checkbox">
-					<input class="checkbox" type="checkbox" tabindex="<%=2000+idx%>" name="<%= idx += 1 %>" value="true"<% if comment.visible? then %> checked<% end %>>
+					<input class="checkbox" type="checkbox" tabindex="<%=2000+idx%>" name="<%= idx += 1 %>" value="true"<% if comment.visible? then %> checked="checked"<% end %> />
 				</span>
 				<span class="commentator"><%=h comment.name %><%=h( " <#{comment.mail}>" ) unless comment.mail.empty? %></span>
 				<span class="commenttime"><%%=comment_date( Time::at( <%=comment.date.to_i%> ) )%></span>
 			</div>
-			<p><%= comment.body.make_link.gsub( /\n/, "<br>" ).gsub( /<br><br>\Z/, '' ) %></p><%
+			<p><%= comment.body.make_link.gsub( /\n/, "<br />" ).gsub( /<br \/><br \/>\Z/, '' ) %></p><%
 		end
 		if idx > 0 then %>
 			<div class="button">
-				<input type="submit" tabindex="<%=2000+idx%>" name="comment" value="ツッコミ表示状態変更">
+				<input type="submit" tabindex="<%=2000+idx%>" name="comment" value="ツッコミ表示状態変更" />
 			</div><%
 		end %>
 		</div>
 	</div></form>
 </div>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="refererlist">
 	<%%= referer_of_today_long( @diaries['<%=@date.strftime( '%Y%m%d' )%>'], 100 )%>
@@ -83,4 +83,4 @@
 
 </div>
 
-<hr class="sep">
+<hr class="sep" />
Index: skel/update.rhtml.en
===================================================================
RCS file: /cvsroot/tdiary/core/skel/update.rhtml.en,v
retrieving revision 1.14.2.1
diff -u -r1.14.2.1 update.rhtml.en
--- skel/update.rhtml.en	4 May 2007 04:07:21 -0000	1.14.2.1
+++ skel/update.rhtml.en	11 Nov 2007 22:43:01 -0000
@@ -45,7 +45,7 @@
 
 <%%=form_proc( @date )%>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="comment">
 	<div class="caption"><%%=comment_today%></div>
@@ -75,7 +75,7 @@
 	</div></form>
 </div>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="refererlist">
 	<%%= referer_of_today_long( @diaries['<%=@date.strftime( '%Y%m%d' )%>'], 100 )%>
@@ -83,4 +83,4 @@
 
 </div>
 
-<hr class="sep">
+<hr class="sep" />
Index: skel/update.rhtml.zh
===================================================================
RCS file: /cvsroot/tdiary/core/skel/update.rhtml.zh,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 update.rhtml.zh
--- skel/update.rhtml.zh	4 May 2007 04:07:21 -0000	1.4.2.2
+++ skel/update.rhtml.zh	11 Nov 2007 22:43:01 -0000
@@ -10,72 +10,72 @@
 	</div>
 	<form class="update" method="post" action="<%=h @conf.update %>"><div>
 		<h3 class="subtitle">日誌主體</h3>
-		<input type="hidden" name="old" value="<%= @date.strftime( '%Y%m%d' ) %>">
+		<input type="hidden" name="old" value="<%= @date.strftime( '%Y%m%d' ) %>" />
 		<%=@csrf_protection%>
 		<span class="field year">
-			<input class="field" name="year" tabindex="1" accesskey="Y" size="4" value="<%= @date.year %>">-
+			<input class="field" name="year" tabindex="1" accesskey="Y" size="4" value="<%= @date.year %>" />-
 		</span>
 		<span class="field month">
-			<input class="field" name="month" tabindex="2" accesskey="M" size="2" value="<%= @date.mon %>">-
+			<input class="field" name="month" tabindex="2" accesskey="M" size="2" value="<%= @date.mon %>" />-
 		</span>
 		<span class="field day">
-			<input class="field" name="day" tabindex="3" accesskey="D" size="2" value="<%= @date.day %>">
+			<input class="field" name="day" tabindex="3" accesskey="D" size="2" value="<%= @date.day %>" />
 		</span>
 		<span class="button edit">
-			<input type="submit" tabindex="4" accesskey="E" name="edit" value="編輯這一天的日誌">
+			<input type="submit" tabindex="4" accesskey="E" name="edit" value="編輯這一天的日誌" />
 		</span>
 		<div class="field title">
-			標題: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>">
+			標題: <input class="field" name="title" tabindex="5" accesskey="T" size="40" value="<%=h @diary.title %>" />
 		</div>
 		<div class="textarea">
 			內文(<%=h @conf.style %> style<%%= style_howto %>):<textarea name="body" tabindex="6" accesskey="C" cols="70" rows="15"><%=h @diary.to_src %></textarea>
 		</div>
 		<%%=edit_proc( @date )%>
 		<span class="button preview">
-			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>">
+			<input type="submit" tabindex="998" accesskey="P" name="<%%= preview_command %>" value="<%%= preview_label %>" />
 		</span>
 		<span class="button append">
-			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> ">
+			<input type="submit" tabindex="999" accesskey="A" name="<%%= submit_command %>" value=" <%%= submit_label %> " />
 		</span>
 		<span class="checkbox hidediary"><label for="hide">
-			<input type="checkbox" id="hide" name="hide" value="true" <% unless @diary.visible? then %>checked <% end %>tabindex="1000" accesskey="H">不要刊出這一天的日誌(隱藏)
+			<input type="checkbox" id="hide" name="hide" value="true" <% unless @diary.visible? then %>checked="checked" <% end %>tabindex="1000" accesskey="H" />不要刊出這一天的日誌(隱藏)
 		</label></span>
 	</div></form>
 </div>
 
 <%%=form_proc( @date )%>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="comment">
 	<div class="caption"><%%=comment_today%></div>
 	<form class="commentstat" method="post" action="<%=h @conf.update %>"><div>
-		<input type="hidden" name="year" value="<%= @date.year %>">
-		<input type="hidden" name="month" value="<%= @date.month %>">
-		<input type="hidden" name="day" value="<%= @date.day %>">
+		<input type="hidden" name="year" value="<%= @date.year %>" />
+		<input type="hidden" name="month" value="<%= @date.month %>" />
+		<input type="hidden" name="day" value="<%= @date.day %>" />
 		<%=@csrf_protection%>
 		<div class="commentbody"><%
 		idx = 0
 		@diary.each_comment do |comment| %>
 			<div class="commentator">
 				<span class="checkbox">
-					<input class="checkbox" type="checkbox" tabindex="<%=2000+idx%>" name="<%= idx += 1 %>" value="true"<% if comment.visible? then %> checked<% end %>>
+					<input class="checkbox" type="checkbox" tabindex="<%=2000+idx%>" name="<%= idx += 1 %>" value="true"<% if comment.visible? then %> checked="checked"<% end %> />
 				</span>
 				<span class="commentator"><%=h comment.name %><%=h( " <#{h comment.mail}>" ) unless comment.mail.empty? %></span>
 				<span class="commenttime"><%%=comment_date( Time::at( <%=comment.date.to_i%> ) )%></span>
 			</div>
-			<p><%= comment.body.make_link.gsub( /\n/, "<br>" ).gsub( /<br><br>\Z/, '' ) %></p><%
+			<p><%= comment.body.make_link.gsub( /\n/, "<br />" ).gsub( /<br \/><br \/>\Z/, '' ) %></p><%
 		end
 		if idx > 0 then %>
 			<div class="button">
-				<input type="submit" tabindex="<%=2000+idx%>" name="comment" value="Change display status of TSUKKOMI">
+				<input type="submit" tabindex="<%=2000+idx%>" name="comment" value="Change display status of TSUKKOMI" />
 			</div><%
 		end %>
 		</div>
 	</div></form>
 </div>
 
-<hr class="sep">
+<hr class="sep" />
 
 <div class="refererlist">
 	<%%= referer_of_today_long( @diaries['<%=@date.strftime( '%Y%m%d' )%>'], 100 )%>
@@ -83,4 +83,4 @@
 
 </div>
 
-<hr class="sep">
+<hr class="sep" />
Index: tdiary/defaultio.rb
===================================================================
RCS file: /cvsroot/tdiary/core/tdiary/defaultio.rb,v
retrieving revision 1.43.2.4
diff -u -r1.43.2.4 defaultio.rb
--- tdiary/defaultio.rb	12 Apr 2007 00:42:40 -0000	1.43.2.4
+++ tdiary/defaultio.rb	11 Nov 2007 22:43:02 -0000
@@ -58,6 +58,7 @@
 				fhc.rewind
 				fhc.truncate( 0 )
 				fhc.puts( TDIARY_MAGIC )
+				diaries = diaries.sort
 				diaries.each do |date,diary|
 					diary.each_comment( diary.count_comments( true ) ) do |com|
 						fhc.puts( "Date: #{date}" )
@@ -94,6 +95,7 @@
 					end
 
 					# convert to referer plugin format
+					diaries = diaries.sort
 					diaries.each do |date,diary|
 						fname = file.sub( /\.tdr$/, "#{date[6,2]}.tdr".untaint )
 						File::open( fname, File::WRONLY | File::CREAT ) do |fhr|
@@ -235,6 +237,7 @@
 			begin
 				fh.seek( 0 )
 				fh.puts( TDIARY_MAGIC )
+				diaries = diaries.sort
 				diaries.each do |date,diary|
 					# save diaries
 					fh.puts( "Date: #{date}" )

