|
|
@ -344,8 +344,10 @@ class Parser { |
|
|
|
$lang = count($lang) > 0 ? trim($lang[0]->data) : null; |
|
|
|
$lang = count($lang) > 0 ? trim($lang[0]->data) : null; |
|
|
|
|
|
|
|
|
|
|
|
$container = $this->document->createElement("pre"); |
|
|
|
$container = $this->document->createElement("pre"); |
|
|
|
if ($lang) |
|
|
|
if ($lang) { |
|
|
|
$container->setAttribute("data-lang", $lang); |
|
|
|
$container->setAttribute("data-lang", $lang); |
|
|
|
|
|
|
|
$container->setAttribute("class", "language-$lang"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$buffer = ""; |
|
|
|
$buffer = ""; |
|
|
|
while (!($this->current()->type === TokenType::BACKTICK && |
|
|
|
while (!($this->current()->type === TokenType::BACKTICK && |
|
|
@ -360,6 +362,10 @@ class Parser { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$elm = $this->document->createElement("code", htmlspecialchars($buffer)); |
|
|
|
$elm = $this->document->createElement("code", htmlspecialchars($buffer)); |
|
|
|
|
|
|
|
if ($lang) { |
|
|
|
|
|
|
|
$elm->setAttribute("data-lang", $lang); |
|
|
|
|
|
|
|
$elm->setAttribute("class", "language-$lang"); |
|
|
|
|
|
|
|
} |
|
|
|
$container->appendChild($elm); |
|
|
|
$container->appendChild($elm); |
|
|
|
$this->document->appendChild($container); |
|
|
|
$this->document->appendChild($container); |
|
|
|
$this->consume(); |
|
|
|
$this->consume(); |
|
|
|