mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Drop legacy optimization code for maintainability
all of those cases can be covered by new Haml::AttributeCompiler!
This commit is contained in:
parent
5ff098a6f0
commit
1a999eae29
1 changed files with 14 additions and 34 deletions
|
@ -120,25 +120,6 @@ module Haml
|
||||||
t[:attributes].merge!({"data-trace" => @options.filename.split('/views').last << ":" << @node.line.to_s})
|
t[:attributes].merge!({"data-trace" => @options.filename.split('/views').last << ":" << @node.line.to_s})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if we can render the tag directly to text and not process it in the buffer
|
|
||||||
if (object_ref == :nil) && attributes_hashes.empty? && !preserve_script
|
|
||||||
tag_closed = !block_given? && !t[:self_closing] && !parse
|
|
||||||
|
|
||||||
open_tag = prerender_tag(t[:name], t[:self_closing], t[:attributes])
|
|
||||||
if tag_closed
|
|
||||||
open_tag << "#{value}</#{t[:name]}>"
|
|
||||||
open_tag << "\n" unless t[:nuke_outer_whitespace]
|
|
||||||
elsif !(parse || t[:nuke_inner_whitespace] ||
|
|
||||||
(t[:self_closing] && t[:nuke_outer_whitespace]))
|
|
||||||
open_tag << "\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
push_merged_text(open_tag,
|
|
||||||
tag_closed || t[:self_closing] || t[:nuke_inner_whitespace] ? 0 : 1)
|
|
||||||
|
|
||||||
@dont_indent_next_line = dont_indent_next_line
|
|
||||||
return if tag_closed
|
|
||||||
else
|
|
||||||
push_merged_text "<#{t[:name]}", 0
|
push_merged_text "<#{t[:name]}", 0
|
||||||
push_temple(@attribute_compiler.compile(t[:attributes], object_ref, attributes_hashes))
|
push_temple(@attribute_compiler.compile(t[:attributes], object_ref, attributes_hashes))
|
||||||
concat_merged_text(
|
concat_merged_text(
|
||||||
|
@ -155,7 +136,6 @@ module Haml
|
||||||
end
|
end
|
||||||
|
|
||||||
@dont_indent_next_line = dont_indent_next_line
|
@dont_indent_next_line = dont_indent_next_line
|
||||||
end
|
|
||||||
|
|
||||||
return if t[:self_closing]
|
return if t[:self_closing]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue