Class: HtmlToHaml::Html::AttributeConversionUseCase

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/html_to_haml/use_cases/html/attribute_conversion_use_case.rb

Constant Summary collapse

HAML_TAG_LINES =
"^\s*%(.*)$"
MULTILINE_ERB_ATTRIBUTES_REGEX =
/^\s*%.*[a-zA-Z1-9]+?=('|")[^'"]*\s*\n\s*=.*\n\s*[^'"]*("|')/

Instance Method Summary collapse

Instance Method Details

#convert_attributes(html:) ⇒ Object



12
13
14
15
16
17
# File 'lib/html_to_haml/use_cases/html/attribute_conversion_use_case.rb', line 12

def convert_attributes(html:)
  erb_converted_html = remove_erb_newlines(html: html)
  erb_converted_html.gsub(/#{HAML_TAG_LINES}/) do |matched_elem|
    haml_with_replaced_attributes(haml: matched_elem)
  end
end