<commit_before><?php

namespace FluxBB\Markdown\Node;

use FluxBB\Markdown\Common\Collection;
use FluxBB\Markdown\Common\Text;

class Paragraph extends Node implements NodeAcceptorInterface
{

    /**
     * @var Collection
     */
    protected $lines;


    public function __construct(Text $text)
    {
        $this->lines = new Collection([$text]);
    }

    public function getText()
    {
        return $this->lines->apply(function (Text $line) {
            return $line->trim();
        })->join("\n");
    }

    public function acceptParagraph(Paragraph $paragraph)
    {
        $paragraph->lines->each(function (Text $line) {
            $this->lines->add($line);
        });

        return $this;
    }

    public function acceptBlankLine(BlankLine $blankLine)
    {
        return $this->parent;
    }

    public function acceptCodeBlock(CodeBlock $codeBlock)
    {
        $codeBlock->getLines()->each(function (Text $line) {
            $this->lines->add($line->prepend('    '));
        });

        return $this;
    }

    public function visit(NodeVisitorInterface $visitor)
    {
        $visitor->enterParagraph($this);

        $visitor->leaveParagraph($this);
    }

}
<commit_msg>Don't trim every line in paragraphs.<commit_after><?php

namespace FluxBB\Markdown\Node;

use FluxBB\Markdown\Common\Collection;
use FluxBB\Markdown\Common\Text;

class Paragraph extends Node implements NodeAcceptorInterface
{

    /**
     * @var Collection
     */
    protected $lines;


    public function __construct(Text $text)
    {
        $this->lines = new Collection([$text]);
    }

    public function getText()
    {
        return (new Text($this->lines->join("\n")))->trim();
    }

    public function acceptParagraph(Paragraph $paragraph)
    {
        $paragraph->lines->each(function (Text $line) {
            $this->lines->add($line);
        });

        return $this;
    }

    public function acceptBlankLine(BlankLine $blankLine)
    {
        return $this->parent;
    }

    public function acceptCodeBlock(CodeBlock $codeBlock)
    {
        $codeBlock->getLines()->each(function (Text $line) {
            $this->lines->add($line->prepend('    '));
        });

        return $this;
    }

    public function visit(NodeVisitorInterface $visitor)
    {
        $visitor->enterParagraph($this);

        $visitor->leaveParagraph($this);
    }

}

{'fraction_non_alphanumeric': 0.13687735454164923, 'fraction_numerical': 0.0, 'mean_word_length': 2.428981348637016, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '1321495', 'n_tokens_mistral': 720, 'n_tokens_neox': 696, 'n_words': 133}