Permalink
Browse files

fixes for issues #1 (html escaping) and #2 (xmlns declaration)

  • Loading branch information...
1 parent 7671559 commit 3cafb4336c2dbd5390bf47b16f5e0a639b4b9158 @capotej committed Apr 27, 2010
Showing with 9 additions and 676 deletions.
  1. +7 −2 lib/has_opengraph/has_opengraph.rb
  2. +0 −671 test/debug.log
  3. BIN test/has_opengrap.sqlite3.db
  4. +2 −3 test/has_opengraph_test.rb
@@ -4,6 +4,11 @@ def self.included(base)
base.send :extend, ClassMethods
end
+ def fb_meta_tag(k,v)
+ '<meta xmlns:og="http://opengraphprotocol.org/schema/" property="og:' << k.to_s << '" content="' << CGI.escapeHTML(v) << '"/>'
+ end
+
+
module ClassMethods
# any method placed here will apply to classes, like Hickwall
def has_opengraph(opts = {})
@@ -28,10 +33,10 @@ def draw_opengraph
self.class.opengraph.each do |k,v|
if v.class == Symbol
if res = self.send(v)
- str << '<meta property="og:' << k.to_s << '" content="' << res << '"/>'
+ str << fb_meta_tag(k,res)
end
else
- str << '<meta property="og:' << k.to_s << '" content="' << v << '"/>'
+ str << fb_meta_tag(k,v)
end
end
str
Oops, something went wrong.

0 comments on commit 3cafb43

Please sign in to comment.