<%# diary.rhtml $Revision: 1.26 $ %><%% @anchor_name = <%=opt['anchor'] || false%> %>
<div class="day">
<h2><%%= title_proc( Time::at( <%=@date.to_i%> ), <%= title.dump.gsub( /%/, '\\\\045' ) %> ) %></h2>

<div class="body">
<%%= body_enter_proc( Time::at( <%=@date.to_i%> ) ) %>
<%= to_html( opt ) %>
<%%= body_leave_proc( Time::at( <%=@date.to_i%> ) ) %>
</div>

<div class="comment">
<%
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="<%= 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="<%= opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c<%= '%02d' % idx %>" %>"><%= opt['comment_anchor'] %></a>
					<span class="commentator"><%= CGI::escapeHTML( comment.name ) %></span>
					<span class="commenttime"><%%=comment_date( Time::at( <%=comment.date.to_i%> ) )%></span>
				</div>
				<p><% if opt['bot'] then %>
					<%= CGI::escapeHTML( comment.body ).gsub( /\n/ , "<br>" ).gsub( /<br><br>\Z/, '' ) %>
				<% else %>
					<%= comment.body.make_link.gsub( /\n/ , "<br>" ).gsub( /<br><br>\Z/, '' ) %>
				<% end %></p><%
			end
		end %>
		</div><%
	else %>
		<div class="caption"><%%=comment_today%><%%=comment_total( <%=count_comments%> )%> [<a href="<%= opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c" %>"><%%=comment_new%></a>]</div>
		<div class="commentshort"><%
		if count_comments > opt['comment_limit'] then %>
			<p><a href="<%= opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c00" %>">Before...</a></p><%
		end
		each_comment_tail( opt['comment_limit'] ) do |comment,idx|
			if comment.visible? %>
				<p><a href="<%= opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c<%= '%02d' % idx %>" %>"><%= opt['comment_anchor'] %></a>
				<span class="commentator"><%= CGI::escapeHTML( comment.name ) %></span>&nbsp;[<%= CGI::escapeHTML( comment.shorten( opt['comment_length'] ) ) %>]</p><%
			end
		end %>
		</div><%
	end
elsif opt['show_comment'] %>
	<div class="caption">[<a href="<%= opt['index'] %><%%=anchor "<%= @date.strftime( '%Y%m%d' ) %>#c" %>"><%%=comment_new%></a>]</div><%
end %>
</div>

<%%=comment_form%>

<%% unless @plugin_files.grep(/tb-show.rb\z/).empty? then %><%
	if opt['long_mode'] then %><%%=
		trackbacks_of_today_long( @diaries["<%= @date.strftime( '%Y%m%d' ) %>"] )
	 %><% else %><%%=
		trackbacks_of_today_short( @diaries["<%= @date.strftime( '%Y%m%d' ) %>"] )
	%><% end %><%%
end %>

<%% unless @plugin_files.grep(/pb-show.rb\z/).empty? then %><%
	if opt['long_mode'] then %><%%=
		pingbacks_of_today_long( @diaries["<%= @date.strftime( '%Y%m%d' ) %>"] )
	 %><% else %><%%=
		pingbacks_of_today_short( @diaries["<%= @date.strftime( '%Y%m%d' ) %>"] )
	%><% end %><%%
end %>

<%
if opt['show_referer'] then
	if opt['long_mode'] then %>
		<div class="refererlist">
		<%%= referer_of_today_long( @diaries['<%=@date.strftime( '%Y%m%d' )%>'], <%=opt['referer_limit']%> )%>
		</div><%
	else %>
		<div class="referer">
		<%%=referer_of_today_short( @diaries['<%=@date.strftime( '%Y%m%d' )%>'], <%=opt['referer_limit']%> )%>
		</div><%
	end
end %>
</div>

