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[ - + - + moving... Wait or Click here! 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( /

\s*<\/p>/im, '' ) end end @@ -980,7 +980,7 @@ end def help( name ) - %Q[

Help
] + %Q[
Help
] end def method_missing( *m ) @@ -1040,7 +1040,7 @@ rescue Exception raise end - return r + return r.gsub( /

\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( /

\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[ - + - + moving... Wait or Click here! 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[

#$! (#{h $!.class})
cannot read #{h file}.

] + %Q[

#$! (#{h $!.class})
cannot read #{h file}.

] end end @@ -168,7 +168,7 @@ # define DOCTYPE # def doctype - %Q[] + %Q[] end # @@ -177,8 +177,8 @@ add_header_proc do calc_links <<-HEADER - - + + #{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|| + %Q|| else '' end end def content_script_type - %Q[] + %Q[] end def author_name_tag if @author_name and not(@author_name.empty?) then - %Q[] + %Q[] else '' end @@ -282,7 +291,7 @@ def author_mail_tag if @author_mail and not(@author_mail.empty?) then - %Q[] + %Q[] else '' end @@ -291,25 +300,25 @@ def index_page_tag result = '' if @index_page and @index_page.size > 0 then - result << %Q[\n\t] + result << %Q[\n\t] end if @prev_day then case @mode when 'day' - result << %Q[\n\t] + result << %Q[\n\t] when 'nyear' - result << %Q[\n\t] + result << %Q[\n\t] end end if @next_day then case @mode when 'day' - result << %Q[\n\t] + result << %Q[\n\t] when 'nyear' - result << %Q[\n\t] + result << %Q[\n\t] end end - result << %Q[\n\t] + result << %Q[\n\t] result.chop.chop end @@ -321,15 +330,15 @@ if @mode == 'day' then uri += anchor( @date.strftime( '%Y%m%d' ) ) end - %Q[] + %Q[] end def icon_tag if @conf.icon and not(@conf.icon.empty?) then if /\.ico$/ =~ @conf.icon then - %Q[] + %Q[] else - %Q[] + %Q[] end else '' @@ -338,7 +347,7 @@ def description_tag if @conf.description and not(@conf.description.empty?) then - %Q[] + %Q[] else '' end @@ -356,15 +365,15 @@ end title = File::basename( css, '.css' ) <<-CSS - - - + + + CSS end def robot_control if /^form|edit|preview|showcomment$/ =~ @mode then - '' + '' else '' end @@ -456,7 +465,7 @@ else if date then r << "#{@conf.section_anchor} ] end @@ -523,24 +532,24 @@ FORM if @diaries[@date.strftime('%Y%m%d')].count_comments( true ) >= @conf.comment_limit_per_day then r << <<-FORM -
#{comment_limit_label}
+
#{comment_limit_label}
FORM else r << <<-FORM -
#{comment_description}
-
- + +
+
- #{comment_name_label}: -
-
- #{comment_mail_label}: + #{comment_name_label}:
+
#{comment_body_label}:
- +
FORM @@ -707,7 +716,7 @@

-

#{@theme_thumbnail_label}

+

#{@theme_thumbnail_label}