Ticket #48 (new defect)

Opened 20 months ago

Last modified 11 months ago

markaby 0.5 is warnings clean! YAY! but builder isn't BOO

Reported by: zenspider Owned by: somebody
Priority: minor Milestone:
Component: lib Version:
Keywords: Cc:

Description

This'll patch it up. Unfortunately Jim doesn't have trackers enabled so I'll have to send him an email. He's been crazy busy lately so I don't think it is going to get cleaned up anytime soon.

Could you please add the following diff?

Index: lib/markaby/builder.rb
===================================================================
--- lib/markaby/builder.rb	(revision 99)
+++ lib/markaby/builder.rb	(working copy)
@@ -269,6 +269,9 @@
 
   class XmlMarkup < ::Builder::XmlMarkup
     attr_accessor :target, :level
+    def initialize(options={})
+      super
+      @self = nil unless defined? @self
+    end
   end
-  
 end

Change History

Changed 11 months ago by pcastellazzi

This fix all warnings in markaby 0.5 builder and metaid. As far as i tested markaby 0.5 is now warning free.

diff -Nurp markaby-0.5/lib/markaby/builder.rb markaby-0.5-no-warnings/lib/markaby/builder.rb
--- markaby-0.5/lib/markaby/builder.rb	2007-10-07 13:12:51.000000000 -0500
+++ markaby-0.5-no-warnings/lib/markaby/builder.rb	2007-10-07 13:11:34.000000000 -0500
@@ -152,7 +152,7 @@ module Markaby
           end
       end
       if block
-        str = capture &block
+        str = capture(&block)
         block = proc { text(str) }
       end
 
@@ -227,6 +227,7 @@ module Markaby
 
     # Builds a head tag.  Adds a <tt>meta</tt> tag inside with Content-Type
     # set to <tt>text/html; charset=utf-8</tt>.
+    alias_method :original_head, :head
     def head(*args, &block)
       tag!(:head, *args) do
         tag!(:meta, "http-equiv" => "Content-Type", "content" => "text/html; charset=utf-8") if @output_meta_tag
@@ -239,13 +240,13 @@ module Markaby
     # :lang => "en"</tt>.
     def xhtml_transitional(&block)
       self.tagset = Markaby::XHTMLTransitional
-      xhtml_html &block
+      xhtml_html(&block)
     end
 
     # Builds an html tag with XHTML 1.0 Strict doctype instead.
     def xhtml_strict(&block)
       self.tagset = Markaby::XHTMLStrict
-      xhtml_html &block
+      xhtml_html(&block)
     end
 
     private
@@ -273,7 +274,7 @@ module Markaby
   # For a more practical explanation, check out the README.
   class Fragment < ::Builder::BlankSlate
     def initialize(s, a, b)
-      @s, @f1, @f2 = s, a, b 
+      @s, @f1, @f2, @str = s, a, b, nil
     end
     def method_missing(*a)
       unless @str
diff -Nurp markaby-0.5/lib/markaby/metaid.rb markaby-0.5-no-warnings/lib/markaby/metaid.rb
--- markaby-0.5/lib/markaby/metaid.rb	2007-10-07 13:12:51.000000000 -0500
+++ markaby-0.5-no-warnings/lib/markaby/metaid.rb	2007-10-07 13:07:06.000000000 -0500
@@ -2,7 +2,7 @@
 class Object
   # The hidden singleton lurks behind everyone
   def metaclass; class << self; self; end; end
-  def meta_eval &blk; metaclass.instance_eval &blk; end
+  def meta_eval &blk; metaclass.instance_eval(&blk); end
   
   # Adds methods to a metaclass
   def meta_def name, &blk
diff -Nurp markaby-0.5/test/test_markaby.rb markaby-0.5-no-warnings/test/test_markaby.rb
--- markaby-0.5/test/test_markaby.rb	2007-10-07 13:12:51.000000000 -0500
+++ markaby-0.5-no-warnings/test/test_markaby.rb	2007-10-07 13:12:34.000000000 -0500
@@ -1,6 +1,8 @@
 require 'test/unit'
 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'markaby'))
 
+$VERBOSE = true
+
 module MarkabyTestHelpers
   def link_to(obj)
     %{<a href="">#{obj}</a>}
Note: See TracTickets for help on using tickets.