[Hiki-cvs 1501] [1048] * hiki/util.rb (Hiki::Util): add module functions (escape,

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 9月 5日 (土) 12:56:31 JST


Revision: 1048
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1048
Author:   okkez
Date:     2009-09-05 12:56:31 +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/branches/rack/ChangeLog
    hiki/branches/rack/hiki/util.rb

Modified: hiki/branches/rack/ChangeLog
===================================================================
--- hiki/branches/rack/ChangeLog	2009-09-05 03:53:50 UTC (rev 1047)
+++ hiki/branches/rack/ChangeLog	2009-09-05 03:56:31 UTC (rev 1048)
@@ -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
@@ -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/branches/rack/hiki/util.rb
===================================================================
--- hiki/branches/rack/hiki/util.rb	2009-09-05 03:53:50 UTC (rev 1047)
+++ hiki/branches/rack/hiki/util.rb	2009-09-05 03:56:31 UTC (rev 1048)
@@ -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




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