<commit_before><?php

namespace FluxBB\CommonMark\Parser\Block;

use FluxBB\CommonMark\Common\Text;
use FluxBB\CommonMark\Node\Blockquote;
use FluxBB\CommonMark\Node\Container;
use FluxBB\CommonMark\Parser\AbstractBlockParser;

class BlockquoteParser extends AbstractBlockParser
{

    /**
     * Parse the given content.
     *
     * Any newly created nodes should be pushed to the stack. Any remaining content should be passed to the next parser
     * in the chain.
     *
     * @param Text $content
     * @param Container $target
     * @return void
     */
    public function parseBlock(Text $content, Container $target)
    {
        $content->handle(
            '/
                ^
                [ ]{0,3}        # up to 3 leading spaces
                \>              # block quote marker
                [ ]?            # an optional space
                [^\n]*          # until end of line
                (?:                 # lazy continuation
                    \n
                    [^\-*=\ ].*
                )*
                $
            /mx',
            function (Text $content) use ($target) {
                // Remove block quote marker plus surrounding whitespace on each line
                $content->replace('/^[ ]{0,3}\>[ ]?/m', '');

                $blockquote = new Blockquote();
                $target->acceptBlockquote($blockquote);

                $this->first->parseBlock($content, $blockquote);
            },
            function (Text $part) use ($target) {
                $this->next->parseBlock($part, $target);
            }
        );
    }
<commit_msg>Allow leading space in lazy continuation lines.<commit_after><?php

namespace FluxBB\CommonMark\Parser\Block;

use FluxBB\CommonMark\Common\Text;
use FluxBB\CommonMark\Node\Blockquote;
use FluxBB\CommonMark\Node\Container;
use FluxBB\CommonMark\Parser\AbstractBlockParser;

class BlockquoteParser extends AbstractBlockParser
{

    /**
     * Parse the given content.
     *
     * Any newly created nodes should be pushed to the stack. Any remaining content should be passed to the next parser
     * in the chain.
     *
     * @param Text $content
     * @param Container $target
     * @return void
     */
    public function parseBlock(Text $content, Container $target)
    {
        $content->handle(
            '/
                ^
                [ ]{0,3}        # up to 3 leading spaces
                \>              # block quote marker
                [ ]?            # an optional space
                [^\n]*          # until end of line
                (?:                 # lazy continuation
                    \n
                    [ ]{0,3}
                    [^\-*=\ ].*
                )*
                $
            /mx',
            function (Text $content) use ($target) {
                // Remove block quote marker plus surrounding whitespace on each line
                $content->replace('/^[ ]{0,3}\>[ ]?/m', '');

                $blockquote = new Blockquote();
                $target->acceptBlockquote($blockquote);

                $this->first->parseBlock($content, $blockquote);
            },
            function (Text $part) use ($target) {
                $this->next->parseBlock($part, $target);
            }
        );
    }

{'fraction_non_alphanumeric': 0.11141552511415526, 'fraction_numerical': 0.0036529680365296802, 'mean_word_length': 1.4268833087149189, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5270538', 'n_tokens_mistral': 872, 'n_tokens_neox': 817, 'n_words': 225}