[Groonga-commit] groonga/heroku-sample-rroonga-blog at 99cb3f3 [master] Use html_safe rather than raw

Back to archive index

Kouhei Sutou null+****@clear*****
Sun May 25 16:55:55 JST 2014


Kouhei Sutou	2014-05-25 16:55:55 +0900 (Sun, 25 May 2014)

  New Revision: 99cb3f32027a00070623e26d7297f6a33f5c913f
  https://github.com/groonga/heroku-sample-rroonga-blog/commit/99cb3f32027a00070623e26d7297f6a33f5c913f

  Message:
    Use html_safe rather than raw

  Modified files:
    app/helpers/posts_helper.rb
    lib/highlighter.rb

  Modified: app/helpers/posts_helper.rb (+1 -1)
===================================================================
--- app/helpers/posts_helper.rb    2014-05-25 16:51:10 +0900 (886a156)
+++ app/helpers/posts_helper.rb    2014-05-25 16:55:55 +0900 (7495418)
@@ -1,7 +1,7 @@
 module PostsHelper
   def highlight(text)
     if @highlighter
-      raw(@highlighter.highlight(text))
+      @highlighter.highlight(text)
     else
       text
     end

  Modified: lib/highlighter.rb (+2 -1)
===================================================================
--- lib/highlighter.rb    2014-05-25 16:51:10 +0900 (a60941e)
+++ lib/highlighter.rb    2014-05-25 16:55:55 +0900 (9bbfc1e)
@@ -14,8 +14,9 @@ class Highlighter
     options = {
       other_text_handler: other_text_handler,
     }
-    @patricia_trie.tag_keys(text, options) do |record, word|
+    highlighted_text = @patricia_trie.tag_keys(text, options) do |record, word|
       "<span class=\"keyword\">#{ERB::Util.html_escape(word)}</span>"
     end
+    highlighted_text.html_safe
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index