class ERBLint::Linters::BlankslateApiMigration
def build_replacement_blankslate(kwargs, indent)
def build_replacement_blankslate(kwargs, indent) data = build_blankslate_arguments(kwargs) component_args = args_to_s(data[:arguments]) # If Blankslate has no heading, we don't update it. return if data[:slots][:heading][:content].nil? # If Blankslate sets both image and icon. don't update it. return if data[:slots][:visual_icon].present? && data[:slots][:visual_image].present? slots = data[:slots].map do |slot, slot_data| next if slot_data.empty? slot_args = args_to_s(slot_data.except(:content)) content = slot_data[:content] if content <<~HTML.indent(2) <% c.#{slot}#{slot_args} do %> #{content} <% end %> HTML else <<~HTML.indent(2) <% c.#{slot}#{slot_args} %> HTML end end.compact.join("\n").chomp # Body needs to match the file indentation. body = <<~HTML.indent(indent).chomp #{slots} <% end %> HTML # The render call will always be aligned. "<%= render Primer::Beta::Blankslate.new#{component_args} do |c| %>\n#{body}" end