[Hiki-cvs 1482] [1028] fix math plugin

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 8月 30日 (日) 23:46:43 JST


Revision: 1028
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1028
Author:   okkez
Date:     2009-08-30 23:46:43 +0900 (Sun, 30 Aug 2009)

Log Message:
-----------
fix math plugin

Modified Paths:
--------------
    hiki/branches/rack/misc/plugin/math.rb

Modified: hiki/branches/rack/misc/plugin/math.rb
===================================================================
--- hiki/branches/rack/misc/plugin/math.rb	2009-08-30 14:46:39 UTC (rev 1027)
+++ hiki/branches/rack/misc/plugin/math.rb	2009-08-30 14:46:43 UTC (rev 1028)
@@ -1,17 +1,15 @@
 def math_latex_download
   params     =****@cgi*****
-  page       = (params['p'][0] || '')
-  file_name  = (params['file_name'][0] || '')
+  page       = (params['p'] || '')
+  file_name  = (params['file_name'] || '')
   image_file = "#{@cache_path}/math_latex/#{escape(page)}/#{escape(file_name)}"
   mime_type  = "image/png"
 
-  header = Hash::new
+  header = {}
   header['Content-Type'] = mime_type
-  header['Last-Modified'] = CGI::rfc1123_date(File.mtime(image_file.untaint))
+  header['Last-Modified'] = CGI.rfc1123_date(File.mtime(image_file.untaint))
   header['Content-Disposition'] = %Q|filename="#{file_name.to_sjis}"|
-  print****@cgi*****(header)
-  print open(image_file.untaint, "rb").read
-  nil
+  ::Hiki::Response.new(File.open(image_file.untaint, "rb").read, 200, header)
 end
 
 add_header_proc {
@@ -59,17 +57,17 @@
 
 def saveconf_math
   if @mode == 'saveconf' then
-    @conf['math.latex.ptsize'] =****@cgi*****['math.latex.ptsize'][0]
-    @conf['math.latex.documentclass'] =****@cgi*****['math.latex.documentclass'][0]
-    @conf['math.latex.preamble'] =****@cgi*****['math.latex.preamble'][0]
-    @conf['math.latex.log'] = (@cgi.params['math.latex.log'][0] == 'true')
+    @conf['math.latex.ptsize'] =****@cgi*****['math.latex.ptsize']
+    @conf['math.latex.documentclass'] =****@cgi*****['math.latex.documentclass']
+    @conf['math.latex.preamble'] =****@cgi*****['math.latex.preamble']
+    @conf['math.latex.log'] = (@cgi.params['math.latex.log'] == 'true')
     unless (@conf['math.latex.secure'] || true) then
-      @conf['math.latex.latex'] =****@cgi*****['math.latex.latex'][0]
-      @conf['math.latex.dvips'] =****@cgi*****['math.latex.dvips'][0]
-      @conf['math.latex.convert'] =****@cgi*****['math.latex.convert'][0]
+      @conf['math.latex.latex'] =****@cgi*****['math.latex.latex']
+      @conf['math.latex.dvips'] =****@cgi*****['math.latex.dvips']
+      @conf['math.latex.convert'] =****@cgi*****['math.latex.convert']
     end
     math_init
-    if****@cgi*****['math.latex.cache_clear'][0] == 'true' then
+    if****@cgi*****['math.latex.cache_clear'] == 'true' then
       math_clear_cache
     end
   end




Hiki-cvs メーリングリストの案内
Back to archive index