def sanctify_liquid_tags(head)
      modified  = false
      tag_names = head.scan(LIQUID_TAG_REGEX)
      tag_names.flatten!
      tag_names.reverse_each do |tag_name|
        next unless liquid_block?(tag_name)
        next if head =~ endtag_regex_stash(tag_name)

        modified = true
        head << "\n{% end#{tag_name} %}"
      end

      print_build_warning if modified
      head
    end
def sanctify_liquid_tags(head)
      modified  = false
      tag_names = head.scan(LIQUID_TAG_REGEX)
      tag_names.flatten!
      tag_names.reverse_each do |tag_name|
        next unless liquid_block?(tag_name)
        next if head =~ endtag_regex_stash(tag_name)

        modified = true
        head << "\n{% end#{tag_name} %}"
      end

      print_build_warning if modified
      head
    end
append appropriate closing tag(s) (for each Liquid block), to the `head` if the
 partitioning resulted in leaving the closing tag somewhere in the `tail` partition.