mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Haml] Fix the problem added in 408da5f
, re-enable the disabled optimizations.
This commit is contained in:
parent
050d263fd2
commit
edc209e514
2 changed files with 9 additions and 6 deletions
3
TODO
3
TODO
|
@ -14,9 +14,6 @@
|
|||
Lexer errors in particular are icky
|
||||
See in particular error changes made in c07b5c8
|
||||
** Haml
|
||||
Fix problem added in 408da5f
|
||||
Might be able to do this by fiddling with when we resolve_newlines
|
||||
Might take larger-scale refactoring
|
||||
Support finer-grained HTML-escaping in filters
|
||||
Speed
|
||||
Make tags with dynamic attributes pre-render as much as possible
|
||||
|
|
|
@ -308,6 +308,7 @@ END
|
|||
|
||||
str = ""
|
||||
mtabs = 0
|
||||
newlines = 0
|
||||
@to_merge.each do |type, val, tabs|
|
||||
case type
|
||||
when :text
|
||||
|
@ -317,8 +318,11 @@ END
|
|||
if mtabs != 0 && !@options[:ugly]
|
||||
val = "_hamlout.adjust_tabs(#{mtabs}); " + val
|
||||
end
|
||||
str << "\#{#{val}}"
|
||||
str << "\#{#{"\n" * newlines}#{val}}"
|
||||
mtabs = 0
|
||||
newlines = 0
|
||||
when :newlines
|
||||
newlines += val
|
||||
else
|
||||
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Precompiler@to_merge.")
|
||||
end
|
||||
|
@ -330,6 +334,7 @@ END
|
|||
else
|
||||
"_hamlout.push_text(\"#{str}\", #{mtabs}, #{@dont_tab_up_next_text.inspect});"
|
||||
end
|
||||
@precompiled << "\n" * newlines
|
||||
@to_merge = []
|
||||
@dont_tab_up_next_text = false
|
||||
end
|
||||
|
@ -1012,8 +1017,7 @@ END
|
|||
|
||||
def resolve_newlines
|
||||
return unless @newlines > 0
|
||||
flush_merged_text unless @to_merge.all? {|type, *_| type == :text}
|
||||
@precompiled << "\n" * @newlines
|
||||
@to_merge << [:newlines, @newlines]
|
||||
@newlines = 0
|
||||
end
|
||||
|
||||
|
@ -1037,6 +1041,8 @@ END
|
|||
when :script
|
||||
last[1].gsub!(/\(haml_temp, (.*?)\);$/, '(haml_temp.rstrip, \1);')
|
||||
rstrip_buffer! index - 1
|
||||
when :newlines
|
||||
rstrip_buffer! index - 1
|
||||
else
|
||||
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Precompiler@to_merge.")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue