Permalink
Browse files

fix #676

  • Loading branch information...
joyqi committed Nov 23, 2017
1 parent c57f34b commit dd79918d2e5a2389face7f0dbefe77c9838e841d
Showing with 21 additions and 5 deletions.
  1. +12 −2 admin/js/hyperdown.js
  2. +9 −3 var/HyperDown.php
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -234,6 +234,11 @@ private function parse($text, $inline = false)
$blocks = $this->parseBlock($text, $lines);
$html = '';
// inline mode for single normal block
if ($inline && count($blocks) == 1 && $blocks[0][0] == 'normal') {
$blocks[0][3] = true;
}
foreach ($blocks as $block) {
list ($type, $start, $end, $value) = $block;
$extract = array_slice($lines, $start, $end - $start + 1);
@@ -244,7 +249,7 @@ private function parse($text, $inline = false)
$result = $this->call('after' . ucfirst($method), $result, $value);
$html .= $result;
}
}
return $html;
}
@@ -1443,9 +1448,10 @@ private function parseHr()
* parseNormal
*
* @param array $lines
* @param bool $inline
* @return string
*/
private function parseNormal(array $lines)
private function parseNormal(array $lines, $inline = false)
{
foreach ($lines as &$line) {
$line = $this->parseInline($line);
@@ -1455,7 +1461,7 @@ private function parseNormal(array $lines)
$str = preg_replace("/(\n\s*){2,}/", "</p><p>", $str);
$str = preg_replace("/\n/", "<br>", $str);
return preg_match("/^\s*$/", $str) ? '' : "<p>{$str}</p>";
return preg_match("/^\s*$/", $str) ? '' : ($inline ? $str : "<p>{$str}</p>");
}
/**

0 comments on commit dd79918

Please sign in to comment.