private function incorporateLine(ContextInterface $context)
{
$cursor = new Cursor($context->getLine());
$context->getBlockCloser()->resetTip();
$context->setBlocksParsed(false);
$this->resetContainer($context, $cursor);
$context->getBlockCloser()->setLastMatchedContainer($context->getContainer());
$this->parseBlocks($context, $cursor);
// What remains at the offset is a text line. Add the text to the appropriate container.
// First check for a lazy paragraph continuation:
if ($this->isLazyParagraphContinuation($context, $cursor)) {
// lazy paragraph continuation
$context->getTip()->addLine($cursor->getRemainder());
return;
}
// not a lazy continuation
// finalize any blocks not matched
$context->getBlockCloser()->closeUnmatchedBlocks();
// Determine whether the last line is blank, updating parents as needed
$this->setAndPropagateLastLineBlank($context, $cursor);
// Handle any remaining cursor contents
if ($context->getContainer()->acceptsLines()) {
$context->getContainer()->handleRemainingContents($context, $cursor);
} elseif (!$cursor->isBlank()) {
// Create paragraph container for line
$context->addBlock(new Paragraph());
$cursor->advanceToFirstNonSpace();
$context->getTip()->addLine($cursor->getRemainder());
}
}