%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 49.231.201.246 / Your IP : 216.73.216.146 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11585/task/11585/cwd/html/ppaobm/vendor/cebe/markdown/block/ |
Upload File : |
<?php
/**
* @copyright Copyright (c) 2014 Carsten Brandt
* @license https://github.com/cebe/markdown/blob/master/LICENSE
* @link https://github.com/cebe/markdown#readme
*/
namespace cebe\markdown\block;
/**
* Adds the headline blocks
*/
trait HeadlineTrait
{
/**
* identify a line as a headline
*/
protected function identifyHeadline($line, $lines, $current)
{
return (
// heading with #
$line[0] === '#' && !preg_match('/^#\d+/', $line)
||
// underlined headline
!empty($lines[$current + 1]) &&
(($l = $lines[$current + 1][0]) === '=' || $l === '-') &&
preg_match('/^(\-+|=+)\s*$/', $lines[$current + 1])
);
}
/**
* Consume lines for a headline
*/
protected function consumeHeadline($lines, $current)
{
if ($lines[$current][0] === '#') {
// ATX headline
$level = 1;
while (isset($lines[$current][$level]) && $lines[$current][$level] === '#' && $level < 6) {
$level++;
}
$block = [
'headline',
'content' => $this->parseInline(trim($lines[$current], "# \t")),
'level' => $level,
];
return [$block, $current];
} else {
// underlined headline
$block = [
'headline',
'content' => $this->parseInline($lines[$current]),
'level' => $lines[$current + 1][0] === '=' ? 1 : 2,
];
return [$block, $current + 1];
}
}
/**
* Renders a headline
*/
protected function renderHeadline($block)
{
$tag = 'h' . $block['level'];
return "<$tag>" . $this->renderAbsy($block['content']) . "</$tag>\n";
}
abstract protected function parseInline($text);
abstract protected function renderAbsy($absy);
}