svnno****@sourc*****
svnno****@sourc*****
2009年 9月 5日 (土) 12:53:50 JST
Revision: 1047 http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1047 Author: okkez Date: 2009-09-05 12:53:50 +0900 (Sat, 05 Sep 2009) Log Message: ----------- * hiki/util.rb (Hiki::Util): add module functions (escape, unescape, escape_html, h, unescape_html) (String#escape, unescape, escapeHTML, unescapeHTML): use Hiki::Util instead of CGI. Modified Paths: -------------- hiki/trunk/ChangeLog hiki/trunk/hiki/util.rb Modified: hiki/trunk/ChangeLog =================================================================== --- hiki/trunk/ChangeLog 2009-09-03 15:25:01 UTC (rev 1046) +++ hiki/trunk/ChangeLog 2009-09-05 03:53:50 UTC (rev 1047) @@ -1,3 +1,10 @@ +2009-09-05 okkez <okkez****@gmail*****> + + * hiki/util.rb (Hiki::Util): add module functions (escape, + unescape, escape_html, h, unescape_html) + (String#escape, unescape, escapeHTML, unescapeHTML): use + Hiki::Util instead of CGI. + 2009-09-03 okkez <okkez****@gmail*****> * hiki/command.rb (Hiki::Command): do not include Hiki::Util on @@ -9,7 +16,7 @@ * hiki/auth/typekey.rb: use literal instead of obvious new method. * hiki/auth/typekey.rb: ditto. - * misc/plugin/attach.rb: ditto. +v * misc/plugin/attach.rb: ditto. * misc/plugin/category.rb: ditto. * misc/plugin/google-sitemaps.rb: ditto. * misc/plugin/incremental_search.rb: ditto. @@ -138,7 +145,7 @@ temporary and should be removed when docdiff becomes Ruby-1.9 ready. - * hiki/util.rb (unified_diff): escape output in this method just + * hiki/util.rb (ppunified_diff): escape output in this method just same as word_diff() does. * misc/plugin/rss.rb (rss_body): remove escape because unified_diff() will escape instead. Modified: hiki/trunk/hiki/util.rb =================================================================== --- hiki/trunk/hiki/util.rb 2009-09-03 15:25:01 UTC (rev 1046) +++ hiki/trunk/hiki/util.rb 2009-09-05 03:53:50 UTC (rev 1047) @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # $Id: util.rb,v 1.44 2005-12-25 07:03:06 yanagita Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi <hitos****@namar*****> @@ -25,20 +26,19 @@ end def escape - CGI.escape(self) + Hiki::Util.escape(self) end def unescape - CGI.unescape(self) + Hiki::Util.unescape(self) end def escapeHTML - ERB::Util.h(self) + Hiki::Util.escape_html(self) end def unescapeHTML - # ??? - CGI.unescapeHTML(self) + Hiki::Util.unescape_html(self) end def sanitize @@ -125,6 +125,8 @@ alias h escapeHTML alias unescape_html unescapeHTML + module_function :escape, :unescape, :escape_html, :h, :unescape_html + def plugin_error(method, e) msg = "<strong>#{e.class} (#{h(e.message)}): #{h(method)}</strong><br>" msg << "<strong>#{e.backtrace.join("<br>\n")}</strong>" if****@conf*****_debug