<commit_before>module ExpressTemplates
  module Components
    module Capabilities
      module Parenting

        # Parenting adds the capability for a component to have and render
        # children that may be specified in the template fragment which
        # includes the component.
        #
        # Example parenting component:
        #
        #   class Line < ExpressTemplates::Components::Base
        #     include Capabilities::Parenting
        #
        #     emits { p.line { _yield } }
        #   end
        #
        # You might then use this component like so:
        #
        #   line "In", "Xanadu", "did", "Kubla", "Khan"
        #   line { "A stately pleasure-dome decree :" }
        #   line { "Where Alph, the sacred river, ran" }
        #   line %q(Through caverns measureless to man)
        #   line %q|Down to a sunless sea.|
        #
        # Provides
        #
        # * ClassMethods for rendering
        # * InstanceMethods for managing children
        #
        def self.included(base)
          base.class_eval do
            include InstanceMethods
          end
        end

        module InstanceMethods
          def children
            @children ||= []
          end

          def children=(children)
            @children =children
          end

          def compile
            null_wrapped_children = "null_wrap { #{compile_children} }"
            wrap_children_src = self.class[:markup].source.gsub(/\W_yield\W/, null_wrapped_children)
            _compile_fragment(Proc.from_source(wrap_children_src))
          end

          def compile_children
            compiled_children = nil
            Indenter.for(:compile) do |indent, indent_with_newline|
              compiled_children = children.map do |child|
                indent_with_newline +
                (child.respond_to?(:compile) ? child.compile : child.inspect) # Bare strings may be children
              end.join("+\n")
              compiled_children.gsub!('"+"', '') # avoid unnecessary string concatenation
            end
            return compiled_children
          end
        end
      end
    end
  end
end<commit_msg>Do not modify whitespace when wrapping children<commit_after>module ExpressTemplates
  module Components
    module Capabilities
      module Parenting

        # Parenting adds the capability for a component to have and render
        # children that may be specified in the template fragment which
        # includes the component.
        #
        # Example parenting component:
        #
        #   class Line < ExpressTemplates::Components::Base
        #     include Capabilities::Parenting
        #
        #     emits { p.line { _yield } }
        #   end
        #
        # You might then use this component like so:
        #
        #   line "In", "Xanadu", "did", "Kubla", "Khan"
        #   line { "A stately pleasure-dome decree :" }
        #   line { "Where Alph, the sacred river, ran" }
        #   line %q(Through caverns measureless to man)
        #   line %q|Down to a sunless sea.|
        #
        # Provides
        #
        # * ClassMethods for rendering
        # * InstanceMethods for managing children
        #
        def self.included(base)
          base.class_eval do
            include InstanceMethods
          end
        end

        module InstanceMethods
          def children
            @children ||= []
          end

          def children=(children)
            @children =children
          end

          def compile
            null_wrapped_children = "null_wrap { #{compile_children} }"
            wrap_children_src = self.class[:markup].source.gsub(/(\s)_yield(\s)/, '\1'+null_wrapped_children+'\2')
            _compile_fragment(Proc.from_source(wrap_children_src))
          end

          def compile_children
            compiled_children = nil
            Indenter.for(:compile) do |indent, indent_with_newline|
              compiled_children = children.map do |child|
                indent_with_newline +
                (child.respond_to?(:compile) ? child.compile : child.inspect) # Bare strings may be children
              end.join("+\n")
              compiled_children.gsub!('"+"', '') # avoid unnecessary string concatenation
            end
            return compiled_children
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07833256985799358, 'fraction_numerical': 0.0004580852038479157, 'mean_word_length': 1.7006802721088434, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3630273', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1116, 'n_words': 315}