<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -890,6 +890,10 @@ $LOAD_PATH &lt;&lt; dir unless $LOAD_PATH.include?(dir)
 #                           so it's really only useful for the user to assign
 #                           when dealing with Haml programatically.
 #
+# [&lt;tt&gt;:line&lt;/tt&gt;]          The line offset of the Haml template being parsed.
+#                           This is useful for inline templates, similar to the last
+#                           argument to Kernel#eval
+#
 # [&lt;tt&gt;:filters&lt;/tt&gt;]       A hash of filters that can be applied to Haml code.
 #                           The keys are the string names of the filters;
 #                           the values are references to the classes of the filters.</diff>
      <filename>lib/haml.rb</filename>
    </modified>
    <modified>
      <diff>@@ -70,6 +70,7 @@ module Haml
           'textile' =&gt; Haml::Filters::Textile,
           'markdown' =&gt; Haml::Filters::Markdown },
         :filename =&gt; '(haml)',
+        :line =&gt; 1,
         :ugly =&gt; false,
         :format =&gt; :xhtml,
         :escape_html =&gt; false
@@ -106,7 +107,7 @@ END
 
       precompile
     rescue Haml::Error
-      $!.backtrace.unshift &quot;#{@options[:filename]}:#{@index + $!.line_offset}&quot; if @index
+      $!.backtrace.unshift &quot;#{@options[:filename]}:#{@index + $!.line_offset + @options[:line] - 1}&quot; if @index
       raise
     end
 
@@ -164,7 +165,7 @@ END
         @haml_buffer = buffer
       end
 
-      eval(@precompiled, scope, @options[:filename])
+      eval(@precompiled, scope, @options[:filename], @options[:line])
 
       # Get rid of the current buffer
       scope_object.instance_eval do
@@ -205,7 +206,7 @@ END
       end
 
       eval(&quot;Proc.new { |*_haml_locals| _haml_locals = _haml_locals[0] || {};&quot; +
-           precompiled_with_ambles(local_names) + &quot;}\n&quot;, scope, @options[:filename])
+           precompiled_with_ambles(local_names) + &quot;}\n&quot;, scope, @options[:filename], @options[:line])
     end
 
     # Defines a method on +object+
@@ -247,7 +248,7 @@ END
       method = object.is_a?(Module) ? :module_eval : :instance_eval
 
       object.send(method, &quot;def #{name}(_haml_locals = {}); #{precompiled_with_ambles(local_names)}; end&quot;,
-                  @options[:filename])
+                  @options[:filename], @options[:line])
     end
 
     private</diff>
      <filename>lib/haml/engine.rb</filename>
    </modified>
    <modified>
      <diff>@@ -218,6 +218,22 @@ END
 
   # Options tests
 
+  def test_filename_and_line
+    begin
+      render(&quot;\n\n = abc&quot;, :filename =&gt; 'test', :line =&gt; 2)
+    rescue Exception =&gt; e
+      assert_kind_of Haml::SyntaxError, e
+      assert_match /test:4/, e.backtrace.first
+    end
+
+    begin
+      render(&quot;\n\n= 123\n\n= nil[]&quot;, :filename =&gt; 'test', :line =&gt; 2)
+    rescue Exception =&gt; e
+      assert_kind_of NoMethodError, e
+      assert_match /test:6/, e.backtrace.first
+    end
+  end
+
   def test_stop_eval
     assert_equal(&quot;&quot;, render(&quot;= 'Hello'&quot;, :suppress_eval =&gt; true))
     assert_equal(&quot;&quot;, render(&quot;- puts 'foo'&quot;, :suppress_eval =&gt; true))</diff>
      <filename>test/haml/engine_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6eb4795a32ed96cfb94b2c055cd072b588d9cab7</id>
    </parent>
  </parents>
  <author>
    <name>Aman Gupta</name>
    <email>aman@tmm1.net</email>
  </author>
  <url>http://github.com/tmm1/haml/commit/0517c9c3e550d2c7eea58c03e257ebd8c8dde28b</url>
  <id>0517c9c3e550d2c7eea58c03e257ebd8c8dde28b</id>
  <committed-date>2008-05-01T23:54:10-07:00</committed-date>
  <authored-date>2008-05-01T23:54:10-07:00</authored-date>
  <message>Add :line option for Haml::Engine</message>
  <tree>f33f5daf71478976d40fa1ea06d3fa4a9b7a74d1</tree>
  <committer>
    <name>Aman Gupta</name>
    <email>aman@tmm1.net</email>
  </committer>
</commit>
