def visit_tag(current_node)
      attributes = formatted_attributes(current_node)
      children_wo_attributes = (current_node.children - current_node.attributes)

      text = "<#{current_node.name}"

      text += attributes.to_s unless attributes.empty?

      other_than_new_lines = children_wo_attributes.any? { |n| n.type != :newline }

      text += if other_than_new_lines
                '>'
              else
                '/>'
              end

      conditional_nodes = current_node.children.select { |n| n.type == :output && n.conditional }

      unless conditional_nodes.empty?
        buff_code "if (#{conditional_nodes.map(&:value).join(') && (')})"

        @code_indent += 1
      end

      buff_print_text(text, new_line: true, indent: true)

      if other_than_new_lines
        last_node = children_wo_attributes.last
        is_last_newline = !last_node.nil? && last_node.type == :newline
        nodes = if is_last_newline
                  children_wo_attributes[0...-1]
                else
                  children_wo_attributes
                end

        code_indent do
          visit_nodes(nodes)
        end

        buff_print_text("</#{current_node.name}>", new_line: true, indent: true)

        # print new line after the tag
        visit_node(last_node) if is_last_newline
      end

      unless conditional_nodes.empty? # rubocop:disable Style/GuardClause
        @code_indent -= 1

        buff_code 'end'
      end
    end
def visit_tag(current_node)
      attributes = formatted_attributes(current_node)
      children_wo_attributes = (current_node.children - current_node.attributes)

      text = "<#{current_node.name}"

      text += attributes.to_s unless attributes.empty?

      other_than_new_lines = children_wo_attributes.any? { |n| n.type != :newline }

      text += if other_than_new_lines
                '>'
              else
                '/>'
              end

      conditional_nodes = current_node.children.select { |n| n.type == :output && n.conditional }

      unless conditional_nodes.empty?
        buff_code "if (#{conditional_nodes.map(&:value).join(') && (')})"

        @code_indent += 1
      end

      buff_print_text(text, new_line: true, indent: true)

      if other_than_new_lines
        last_node = children_wo_attributes.last
        is_last_newline = !last_node.nil? && last_node.type == :newline
        nodes = if is_last_newline
                  children_wo_attributes[0...-1]
                else
                  children_wo_attributes
                end

        code_indent do
          visit_nodes(nodes)
        end

        buff_print_text("</#{current_node.name}>", new_line: true, indent: true)

        # print new line after the tag
        visit_node(last_node) if is_last_newline
      end

      unless conditional_nodes.empty? # rubocop:disable Style/GuardClause
        @code_indent -= 1

        buff_code 'end'
      end
    end
@param [TagNode] current_node

 @return [nil]