mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Compare commits
6 Commits
1.0.0-rc.2
...
1.0.0-rc.4
Author | SHA1 | Date | |
---|---|---|---|
e8d8801db4 | |||
521803cdcd | |||
0eb480324c | |||
7c78aff578 | |||
2a5f99547c | |||
e373391e7d |
@ -418,7 +418,7 @@ class Parsedown
|
||||
|
||||
protected function identifyFencedCode($Line)
|
||||
{
|
||||
if (preg_match('/^(['.$Line['text'][0].']{3,})[ ]*(\w+)?[ ]*$/', $Line['text'], $matches))
|
||||
if (preg_match('/^(['.$Line['text'][0].']{3,})[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches))
|
||||
{
|
||||
$Element = array(
|
||||
'name' => 'code',
|
||||
@ -470,9 +470,18 @@ class Parsedown
|
||||
return $Block;
|
||||
}
|
||||
|
||||
$string = htmlspecialchars($Line['body'], ENT_NOQUOTES, 'UTF-8');
|
||||
$Block['element']['text']['text'] .= "\n".$Line['body'];;
|
||||
|
||||
$Block['element']['text']['text'] .= "\n".$string;;
|
||||
return $Block;
|
||||
}
|
||||
|
||||
protected function completeFencedCode($Block)
|
||||
{
|
||||
$text = $Block['element']['text']['text'];
|
||||
|
||||
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
||||
|
||||
$Block['element']['text']['text'] = $text;
|
||||
|
||||
return $Block;
|
||||
}
|
||||
@ -548,7 +557,7 @@ class Parsedown
|
||||
{
|
||||
$Block['li']['text'] []= '';
|
||||
|
||||
$text = preg_replace('/^[ ]{0,2}/', '', $Line['body']);
|
||||
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
|
||||
|
||||
$Block['li']['text'] []= $text;
|
||||
|
||||
@ -584,6 +593,8 @@ class Parsedown
|
||||
if (isset($Block['interrupted']))
|
||||
{
|
||||
$Block['element']['text'] []= '';
|
||||
|
||||
unset($Block['interrupted']);
|
||||
}
|
||||
|
||||
$Block['element']['text'] []= $matches[1];
|
||||
@ -762,7 +773,6 @@ class Parsedown
|
||||
if ($Line['indent'] >= 4)
|
||||
{
|
||||
$text = substr($Line['body'], 4);
|
||||
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
||||
|
||||
$Block = array(
|
||||
'element' => array(
|
||||
@ -793,7 +803,6 @@ class Parsedown
|
||||
$Block['element']['text']['text'] .= "\n";
|
||||
|
||||
$text = substr($Line['body'], 4);
|
||||
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
||||
|
||||
$Block['element']['text']['text'] .= $text;
|
||||
|
||||
@ -801,6 +810,17 @@ class Parsedown
|
||||
}
|
||||
}
|
||||
|
||||
protected function completeCodeBlock($Block)
|
||||
{
|
||||
$text = $Block['element']['text']['text'];
|
||||
|
||||
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
||||
|
||||
$Block['element']['text']['text'] = $text;
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
# ~
|
||||
#
|
||||
@ -1051,7 +1071,7 @@ class Parsedown
|
||||
|
||||
protected function identifyEmailTag($excerpt)
|
||||
{
|
||||
if (strpos($excerpt, '>') !== false and preg_match('/<(\S+?@\S+?)>/', $excerpt, $matches))
|
||||
if (strpos($excerpt, '>') !== false and preg_match('/^<(\S+?@\S+?)>/', $excerpt, $matches))
|
||||
{
|
||||
return array(
|
||||
'extent' => strlen($matches[0]),
|
||||
@ -1315,12 +1335,12 @@ class Parsedown
|
||||
protected $textLevelElements = array(
|
||||
'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont',
|
||||
'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',
|
||||
'i', 'rp', 'sub', 'code', 'strike', 'marquee',
|
||||
'q', 'rt', 'sup', 'font', 'strong',
|
||||
's', 'tt', 'var', 'mark',
|
||||
'u', 'xm', 'wbr', 'nobr',
|
||||
'ruby',
|
||||
'span',
|
||||
'i', 'rp', 'del', 'code', 'strike', 'marquee',
|
||||
'q', 'rt', 'ins', 'font', 'strong',
|
||||
's', 'tt', 'sub', 'mark',
|
||||
'u', 'xm', 'sup', 'nobr',
|
||||
'var', 'ruby',
|
||||
'wbr', 'span',
|
||||
'time',
|
||||
);
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
<blockquote>
|
||||
<p>quote
|
||||
the rest of it</p>
|
||||
<p>another paragraph
|
||||
the rest of it</p>
|
||||
</blockquote>
|
@ -1,2 +1,5 @@
|
||||
> quote
|
||||
the rest of it
|
||||
|
||||
> another paragraph
|
||||
the rest of it
|
9
test/data/separated_nested_list.html
Normal file
9
test/data/separated_nested_list.html
Normal file
@ -0,0 +1,9 @@
|
||||
<ul>
|
||||
<li>
|
||||
<p>li</p>
|
||||
<ul>
|
||||
<li>li</li>
|
||||
<li>li</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
4
test/data/separated_nested_list.md
Normal file
4
test/data/separated_nested_list.md
Normal file
@ -0,0 +1,4 @@
|
||||
- li
|
||||
|
||||
- li
|
||||
- li
|
Reference in New Issue
Block a user