3 * @copyright Copyright (c) 2014 Carsten Brandt
4 * @license https://github.com/cebe/markdown/blob/master/LICENSE
5 * @link https://github.com/cebe/markdown#readme
8 namespace cebe\markdown\block;
11 * Adds the block quote elements
16 * identify a line as the beginning of a block quote.
18 protected function identifyQuote($line)
20 return $line[0] === '>' && (!isset($line[1]) || ($l1 = $line[1]) === ' ' || $l1 === "\t");
24 * Consume lines for a blockquote element
26 protected function consumeQuote($lines, $current)
28 // consume until newline
30 for ($i = $current, $count = count($lines); $i < $count; $i++) {
32 if (ltrim($line) !== '') {
33 if ($line[0] == '>' && !isset($line[1])) {
35 } elseif (strncmp($line, '> ', 2) === 0) {
36 $line = substr($line, 2);
46 'content' => $this->parseBlocks($content),
54 * Renders a blockquote
56 protected function renderQuote($block)
58 return '<blockquote>' . $this->renderAbsy($block['content']) . "</blockquote>\n";
61 abstract protected function parseBlocks($lines);
62 abstract protected function renderAbsy($absy);