1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Haml] Fix an error line-numbering bug with =.

This is a bad solution, as it breaks up merged text unnecessarily.
This breaking up may not be fixable
without some refactoring of the precompiler, though,
so that's being pushed off to the master branch
to be released as part of 2.4.
This commit is contained in:
Nathan Weizenbaum 2009-11-03 20:18:13 -08:00
parent 4fe3e5045f
commit 408da5f3da
3 changed files with 8 additions and 0 deletions

View file

@ -15,6 +15,12 @@
* Use `ensure` to protect the resetting of the Haml output buffer
against exceptions that are raised within the compiled Haml code.
* Fix an error line-numbering bug that appeared if an error was thrown
within loud script (`=`).
This is not the best solution, as it disables a few optimizations,
but it shouldn't have too much effect and the optimizations
will hopefully be re-enabled in version 2.4.
## [2.2.10](http://github.com/nex3/haml/commit/2.2.10)
* Fixed a bug where elements with dynamic attributes and no content

View file

@ -1002,6 +1002,7 @@ END
def resolve_newlines
return unless @newlines > 0
flush_merged_text unless @to_merge.all? {|type, *_| type == :text}
@precompiled << "\n" * @newlines
@newlines = 0
end

View file

@ -72,6 +72,7 @@ class EngineTest < Test::Unit::TestCase
"/ foo\n\n bar" => ["Illegal nesting: nesting within a tag that already has content is illegal.", 3],
"!!!\n\n bar" => ["Illegal nesting: nesting within a header command is illegal.", 3],
"foo\n:ruby\n 1\n 2\n 3\n- raise 'foo'" => ["foo", 6],
"= raise 'foo'\nfoo\nbar\nbaz\nbang" => ["foo", 1],
}
User = Struct.new('User', :id)