diff --git a/CHANGELOG.md b/CHANGELOG.md
index de58949..cc5bcf3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
## master
+## 1.2.3RC1
+* RESOLVE michael-cannon/testimonials-widget#184 Remove deprecated constructor calls for WP_Widget
+* Update Parsedown library
+
## 1.2.2
* Add Inside Axelerant link
* Store branding updates
diff --git a/README.md b/README.md
index c214b9b..b276c3a 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Aihrus Framework
Tested up to: 4.1.0
-Stable tag: 1.2.2
+Stable tag: 1.2.3RC1
A helper library for WordPress plugins by Aihrus and maintained by [Axelerant](//axelerant.com).
diff --git a/aihrus-framework.php b/aihrus-framework.php
index 3ed9484..d313c85 100644
--- a/aihrus-framework.php
+++ b/aihrus-framework.php
@@ -35,7 +35,7 @@
}
if ( ! defined( 'AIHR_VERSION' ) ) {
- define( 'AIHR_VERSION', '1.2.2' );
+ define( 'AIHR_VERSION', '1.2.3RC1' );
}
require_once ABSPATH . 'wp-admin/includes/plugin.php';
diff --git a/includes/class-aihrus-widget.php b/includes/class-aihrus-widget.php
index a898505..90f4658 100644
--- a/includes/class-aihrus-widget.php
+++ b/includes/class-aihrus-widget.php
@@ -52,7 +52,7 @@ public function __construct( $classname, $description, $id_base, $title ) {
);
// Create the widget
- $this->WP_Widget(
+ parent::__construct(
static::ID,
$title,
$widget_ops,
diff --git a/includes/libraries/parsedown/.travis.yml b/includes/libraries/parsedown/.travis.yml
index dade257..5df49dc 100644
--- a/includes/libraries/parsedown/.travis.yml
+++ b/includes/libraries/parsedown/.travis.yml
@@ -1,10 +1,16 @@
language: php
php:
+ - 7.0
- 5.6
- 5.5
- 5.4
- 5.3
- - 5.2
- hhvm
-
\ No newline at end of file
+ - hhvm-nightly
+
+matrix:
+ fast_finish: true
+ allow_failures:
+ - php: 7.0
+ - php: hhvm-nightly
diff --git a/includes/libraries/parsedown/Parsedown.php b/includes/libraries/parsedown/Parsedown.php
index e9a8cbd..3a2803a 100644
--- a/includes/libraries/parsedown/Parsedown.php
+++ b/includes/libraries/parsedown/Parsedown.php
@@ -15,28 +15,19 @@
class Parsedown
{
- #
- # Philosophy
+ # ~
- # Parsedown recognises that the Markdown syntax is optimised for humans so
- # it tries to read like one. It goes through text line by line. It looks at
- # how lines start to identify blocks. It looks for special characters to
- # identify inline elements.
+ const version = '1.5.3';
- #
# ~
function text($text)
{
# make sure no definitions are set
- $this->Definitions = array();
+ $this->DefinitionData = array();
# standardize line breaks
- $text = str_replace("\r\n", "\n", $text);
- $text = str_replace("\r", "\n", $text);
-
- # replace tabs with spaces
- $text = str_replace("\t", ' ', $text);
+ $text = str_replace(array("\r\n", "\r"), "\n", $text);
# remove surrounding line breaks
$text = trim($text, "\n");
@@ -57,8 +48,6 @@ function text($text)
# Setters
#
- private $breaksEnabled;
-
function setBreaksEnabled($breaksEnabled)
{
$this->breaksEnabled = $breaksEnabled;
@@ -66,15 +55,35 @@ function setBreaksEnabled($breaksEnabled)
return $this;
}
+ protected $breaksEnabled;
+
+ function setMarkupEscaped($markupEscaped)
+ {
+ $this->markupEscaped = $markupEscaped;
+
+ return $this;
+ }
+
+ protected $markupEscaped;
+
+ function setUrlsLinked($urlsLinked)
+ {
+ $this->urlsLinked = $urlsLinked;
+
+ return $this;
+ }
+
+ protected $urlsLinked = true;
+
#
# Lines
#
protected $BlockTypes = array(
- '#' => array('Atx'),
+ '#' => array('Header'),
'*' => array('Rule', 'List'),
'+' => array('List'),
- '-' => array('Setext', 'Table', 'Rule', 'List'),
+ '-' => array('SetextHeader', 'Table', 'Rule', 'List'),
'0' => array('List'),
'1' => array('List'),
'2' => array('List'),
@@ -87,8 +96,9 @@ function setBreaksEnabled($breaksEnabled)
'9' => array('List'),
':' => array('Table'),
'<' => array('Comment', 'Markup'),
- '=' => array('Setext'),
+ '=' => array('SetextHeader'),
'>' => array('Quote'),
+ '[' => array('Reference'),
'_' => array('Rule'),
'`' => array('FencedCode'),
'|' => array('Table'),
@@ -97,14 +107,8 @@ function setBreaksEnabled($breaksEnabled)
# ~
- protected $DefinitionTypes = array(
- '[' => array('Reference'),
- );
-
- # ~
-
protected $unmarkedBlockTypes = array(
- 'CodeBlock',
+ 'Code',
);
#
@@ -127,6 +131,23 @@ private function lines(array $lines)
continue;
}
+ if (strpos($line, "\t") !== false)
+ {
+ $parts = explode("\t", $line);
+
+ $line = $parts[0];
+
+ unset($parts[0]);
+
+ foreach ($parts as $part)
+ {
+ $shortage = 4 - mb_strlen($line, 'utf-8') % 4;
+
+ $line .= str_repeat(' ', $shortage);
+ $line .= $part;
+ }
+ }
+
$indent = 0;
while (isset($line[$indent]) and $line[$indent] === ' ')
@@ -142,9 +163,9 @@ private function lines(array $lines)
# ~
- if (isset($CurrentBlock['incomplete']))
+ if (isset($CurrentBlock['continuable']))
{
- $Block = $this->{'addTo'.$CurrentBlock['type']}($Line, $CurrentBlock);
+ $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock);
if (isset($Block))
{
@@ -154,12 +175,10 @@ private function lines(array $lines)
}
else
{
- if (method_exists($this, 'complete'.$CurrentBlock['type']))
+ if (method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
{
- $CurrentBlock = $this->{'complete'.$CurrentBlock['type']}($CurrentBlock);
+ $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
-
- unset($CurrentBlock['incomplete']);
}
}
@@ -167,21 +186,6 @@ private function lines(array $lines)
$marker = $text[0];
- if (isset($this->DefinitionTypes[$marker]))
- {
- foreach ($this->DefinitionTypes[$marker] as $definitionType)
- {
- $Definition = $this->{'identify'.$definitionType}($Line, $CurrentBlock);
-
- if (isset($Definition))
- {
- $this->Definitions[$definitionType][$Definition['id']] = $Definition['data'];
-
- continue 2;
- }
- }
- }
-
# ~
$blockTypes = $this->unmarkedBlockTypes;
@@ -199,7 +203,7 @@ private function lines(array $lines)
foreach ($blockTypes as $blockType)
{
- $Block = $this->{'identify'.$blockType}($Line, $CurrentBlock);
+ $Block = $this->{'block'.$blockType}($Line, $CurrentBlock);
if (isset($Block))
{
@@ -207,14 +211,14 @@ private function lines(array $lines)
if ( ! isset($Block['identified']))
{
- $Elements []= $CurrentBlock['element'];
+ $Blocks []= $CurrentBlock;
$Block['identified'] = true;
}
- if (method_exists($this, 'addTo'.$blockType))
+ if (method_exists($this, 'block'.$blockType.'Continue'))
{
- $Block['incomplete'] = true;
+ $Block['continuable'] = true;
}
$CurrentBlock = $Block;
@@ -231,9 +235,9 @@ private function lines(array $lines)
}
else
{
- $Elements []= $CurrentBlock['element'];
+ $Blocks []= $CurrentBlock;
- $CurrentBlock = $this->buildParagraph($Line);
+ $CurrentBlock = $this->paragraph($Line);
$CurrentBlock['identified'] = true;
}
@@ -241,59 +245,49 @@ private function lines(array $lines)
# ~
- if (isset($CurrentBlock['incomplete']) and method_exists($this, 'complete'.$CurrentBlock['type']))
+ if (isset($CurrentBlock['continuable']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
{
- $CurrentBlock = $this->{'complete'.$CurrentBlock['type']}($CurrentBlock);
+ $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
# ~
- $Elements []= $CurrentBlock['element'];
-
- unset($Elements[0]);
+ $Blocks []= $CurrentBlock;
- # ~
-
- $markup = $this->elements($Elements);
+ unset($Blocks[0]);
# ~
- return $markup;
- }
-
- #
- # Atx
+ $markup = '';
- protected function identifyAtx($Line)
- {
- if (isset($Line['text'][1]))
+ foreach ($Blocks as $Block)
{
- $level = 1;
-
- while (isset($Line['text'][$level]) and $Line['text'][$level] === '#')
+ if (isset($Block['hidden']))
{
- $level ++;
+ continue;
}
- $text = trim($Line['text'], '# ');
+ $markup .= "\n";
+ $markup .= isset($Block['markup']) ? $Block['markup'] : $this->element($Block['element']);
+ }
- $Block = array(
- 'element' => array(
- 'name' => 'h' . min(6, $level),
- 'text' => $text,
- 'handler' => 'line',
- ),
- );
+ $markup .= "\n";
- return $Block;
- }
+ # ~
+
+ return $markup;
}
#
# Code
- protected function identifyCodeBlock($Line)
+ protected function blockCode($Line, $Block = null)
{
+ if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted']))
+ {
+ return;
+ }
+
if ($Line['indent'] >= 4)
{
$text = substr($Line['body'], 4);
@@ -313,7 +307,7 @@ protected function identifyCodeBlock($Line)
}
}
- protected function addToCodeBlock($Line, $Block)
+ protected function blockCodeContinue($Line, $Block)
{
if ($Line['indent'] >= 4)
{
@@ -334,7 +328,7 @@ protected function addToCodeBlock($Line, $Block)
}
}
- protected function completeCodeBlock($Block)
+ protected function blockCodeComplete($Block)
{
$text = $Block['element']['text']['text'];
@@ -348,12 +342,17 @@ protected function completeCodeBlock($Block)
#
# Comment
- protected function identifyComment($Line)
+ protected function blockComment($Line)
{
+ if ($this->markupEscaped)
+ {
+ return;
+ }
+
if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!')
{
$Block = array(
- 'element' => $Line['body'],
+ 'markup' => $Line['body'],
);
if (preg_match('/-->$/', $Line['text']))
@@ -365,14 +364,14 @@ protected function identifyComment($Line)
}
}
- protected function addToComment($Line, array $Block)
+ protected function blockCommentContinue($Line, array $Block)
{
if (isset($Block['closed']))
{
return;
}
- $Block['element'] .= "\n" . $Line['body'];
+ $Block['markup'] .= "\n" . $Line['body'];
if (preg_match('/-->$/', $Line['text']))
{
@@ -385,18 +384,18 @@ protected function addToComment($Line, array $Block)
#
# Fenced Code
- protected function identifyFencedCode($Line)
+ protected function blockFencedCode($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',
'text' => '',
);
- if (isset($matches[2]))
+ if (isset($matches[1]))
{
- $class = 'language-'.$matches[2];
+ $class = 'language-'.$matches[1];
$Element['attributes'] = array(
'class' => $class,
@@ -416,7 +415,7 @@ protected function identifyFencedCode($Line)
}
}
- protected function addToFencedCode($Line, $Block)
+ protected function blockFencedCodeContinue($Line, $Block)
{
if (isset($Block['complete']))
{
@@ -444,7 +443,7 @@ protected function addToFencedCode($Line, $Block)
return $Block;
}
- protected function completeFencedCode($Block)
+ protected function blockFencedCodeComplete($Block)
{
$text = $Block['element']['text']['text'];
@@ -455,10 +454,43 @@ protected function completeFencedCode($Block)
return $Block;
}
+ #
+ # Header
+
+ protected function blockHeader($Line)
+ {
+ if (isset($Line['text'][1]))
+ {
+ $level = 1;
+
+ while (isset($Line['text'][$level]) and $Line['text'][$level] === '#')
+ {
+ $level ++;
+ }
+
+ if ($level > 6)
+ {
+ return;
+ }
+
+ $text = trim($Line['text'], '# ');
+
+ $Block = array(
+ 'element' => array(
+ 'name' => 'h' . min(6, $level),
+ 'text' => $text,
+ 'handler' => 'line',
+ ),
+ );
+
+ return $Block;
+ }
+ }
+
#
# List
- protected function identifyList($Line)
+ protected function blockList($Line)
{
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
@@ -487,9 +519,9 @@ protected function identifyList($Line)
}
}
- protected function addToList($Line, array $Block)
+ protected function blockListContinue($Line, array $Block)
{
- if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'[ ]+(.*)/', $Line['text'], $matches))
+ if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches))
{
if (isset($Block['interrupted']))
{
@@ -500,11 +532,13 @@ protected function addToList($Line, array $Block)
unset($Block['li']);
+ $text = isset($matches[1]) ? $matches[1] : '';
+
$Block['li'] = array(
'name' => 'li',
'handler' => 'li',
'text' => array(
- $matches[1],
+ $text,
),
);
@@ -513,6 +547,11 @@ protected function addToList($Line, array $Block)
return $Block;
}
+ if ($Line['text'][0] === '[' and $this->blockReference($Line))
+ {
+ return $Block;
+ }
+
if ( ! isset($Block['interrupted']))
{
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
@@ -539,7 +578,7 @@ protected function addToList($Line, array $Block)
#
# Quote
- protected function identifyQuote($Line)
+ protected function blockQuote($Line)
{
if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))
{
@@ -555,7 +594,7 @@ protected function identifyQuote($Line)
}
}
- protected function addToQuote($Line, array $Block)
+ protected function blockQuoteContinue($Line, array $Block)
{
if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))
{
@@ -582,9 +621,9 @@ protected function addToQuote($Line, array $Block)
#
# Rule
- protected function identifyRule($Line)
+ protected function blockRule($Line)
{
- if (preg_match('/^(['.$Line['text'][0].'])([ ]{0,2}\1){2,}[ ]*$/', $Line['text']))
+ if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text']))
{
$Block = array(
'element' => array(
@@ -599,7 +638,7 @@ protected function identifyRule($Line)
#
# Setext
- protected function identifySetext($Line, array $Block = null)
+ protected function blockSetextHeader($Line, array $Block = null)
{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
@@ -617,9 +656,14 @@ protected function identifySetext($Line, array $Block = null)
#
# Markup
- protected function identifyMarkup($Line)
+ protected function blockMarkup($Line)
{
- if (preg_match('/^<(\w[\w\d]*)(?:[ ][^>]*)?(\/?)[ ]*>/', $Line['text'], $matches))
+ if ($this->markupEscaped)
+ {
+ return;
+ }
+
+ if (preg_match('/^<(\w*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
{
if (in_array($matches[1], $this->textLevelElements))
{
@@ -627,36 +671,54 @@ protected function identifyMarkup($Line)
}
$Block = array(
- 'element' => $Line['body'],
+ 'name' => $matches[1],
+ 'depth' => 0,
+ 'markup' => $Line['text'],
);
- if ($matches[2] or $matches[1] === 'hr' or preg_match('/<\/'.$matches[1].'>[ ]*$/', $Line['text']))
+ $length = strlen($matches[0]);
+
+ $remainder = substr($Line['text'], $length);
+
+ if (trim($remainder) === '')
{
- $Block['closed'] = true;
+ if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
+ {
+ $Block['closed'] = true;
+
+ $Block['void'] = true;
+ }
}
else
{
- $Block['depth'] = 0;
- $Block['name'] = $matches[1];
+ if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
+ {
+ return;
+ }
+
+ if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder))
+ {
+ $Block['closed'] = true;
+ }
}
return $Block;
}
}
- protected function addToMarkup($Line, array $Block)
+ protected function blockMarkupContinue($Line, array $Block)
{
if (isset($Block['closed']))
{
return;
}
- if (preg_match('/<'.$Block['name'].'([ ][^\/]+)?>/', $Line['text'])) # opening tag
+ if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open
{
$Block['depth'] ++;
}
- if (stripos($Line['text'], ''.$Block['name'].'>') !== false) # closing tag
+ if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close
{
if ($Block['depth'] > 0)
{
@@ -668,15 +730,51 @@ protected function addToMarkup($Line, array $Block)
}
}
- $Block['element'] .= "\n".$Line['body'];
+ if (isset($Block['interrupted']))
+ {
+ $Block['markup'] .= "\n";
+
+ unset($Block['interrupted']);
+ }
+
+ $Block['markup'] .= "\n".$Line['body'];
return $Block;
}
+ #
+ # Reference
+
+ protected function blockReference($Line)
+ {
+ if (preg_match('/^\[(.+?)\]:[ ]*(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches))
+ {
+ $id = strtolower($matches[1]);
+
+ $Data = array(
+ 'url' => $matches[2],
+ 'title' => null,
+ );
+
+ if (isset($matches[3]))
+ {
+ $Data['title'] = $matches[3];
+ }
+
+ $this->DefinitionData['Reference'][$id] = $Data;
+
+ $Block = array(
+ 'hidden' => true,
+ );
+
+ return $Block;
+ }
+ }
+
#
# Table
- protected function identifyTable($Line, array $Block = null)
+ protected function blockTable($Line, array $Block = null)
{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
@@ -710,7 +808,7 @@ protected function identifyTable($Line, array $Block = null)
$alignment = 'left';
}
- if (substr($dividerCell, -1) === ':')
+ if (substr($dividerCell, - 1) === ':')
{
$alignment = $alignment === 'left' ? 'center' : 'right';
}
@@ -744,7 +842,7 @@ protected function identifyTable($Line, array $Block = null)
$alignment = $alignments[$index];
$HeaderElement['attributes'] = array(
- 'align' => $alignment,
+ 'style' => 'text-align: '.$alignment.';',
);
}
@@ -783,8 +881,13 @@ protected function identifyTable($Line, array $Block = null)
}
}
- protected function addToTable($Line, array $Block)
+ protected function blockTableContinue($Line, array $Block)
{
+ if (isset($Block['interrupted']))
+ {
+ return;
+ }
+
if ($Line['text'][0] === '|' or strpos($Line['text'], '|'))
{
$Elements = array();
@@ -794,9 +897,9 @@ protected function addToTable($Line, array $Block)
$row = trim($row);
$row = trim($row, '|');
- $cells = explode('|', $row);
+ preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches);
- foreach ($cells as $index => $cell)
+ foreach ($matches[0] as $index => $cell)
{
$cell = trim($cell);
@@ -809,7 +912,7 @@ protected function addToTable($Line, array $Block)
if (isset($Block['alignments'][$index]))
{
$Element['attributes'] = array(
- 'align' => $Block['alignments'][$index],
+ 'style' => 'text-align: '.$Block['alignments'][$index].';',
);
}
@@ -828,35 +931,11 @@ protected function addToTable($Line, array $Block)
}
}
- #
- # Definitions
- #
-
- protected function identifyReference($Line)
- {
- if (preg_match('/^\[(.+?)\]:[ ]*(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches))
- {
- $Definition = array(
- 'id' => strtolower($matches[1]),
- 'data' => array(
- 'url' => $matches[2],
- ),
- );
-
- if (isset($matches[3]))
- {
- $Definition['data']['title'] = $matches[3];
- }
-
- return $Definition;
- }
- }
-
#
# ~
#
- protected function buildParagraph($Line)
+ protected function paragraph($Line)
{
$Block = array(
'element' => array(
@@ -870,92 +949,27 @@ protected function buildParagraph($Line)
}
#
- # ~
- #
-
- protected function element(array $Element)
- {
- $markup = '<'.$Element['name'];
-
- if (isset($Element['attributes']))
- {
- foreach ($Element['attributes'] as $name => $value)
- {
- $markup .= ' '.$name.'="'.$value.'"';
- }
- }
-
- if (isset($Element['text']))
- {
- $markup .= '>';
-
- if (isset($Element['handler']))
- {
- $markup .= $this->$Element['handler']($Element['text']);
- }
- else
- {
- $markup .= $Element['text'];
- }
-
- $markup .= ''.$Element['name'].'>';
- }
- else
- {
- $markup .= ' />';
- }
-
- return $markup;
- }
-
- protected function elements(array $Elements)
- {
- $markup = '';
-
- foreach ($Elements as $Element)
- {
- if ($Element === null)
- {
- continue;
- }
-
- $markup .= "\n";
-
- if (is_string($Element)) # because of Markup
- {
- $markup .= $Element;
-
- continue;
- }
-
- $markup .= $this->element($Element);
- }
-
- $markup .= "\n";
-
- return $markup;
- }
-
- #
- # Spans
+ # Inline Elements
#
- protected $SpanTypes = array(
- '!' => array('Link'), # ?
- '&' => array('Ampersand'),
+ protected $InlineTypes = array(
+ '"' => array('SpecialCharacter'),
+ '!' => array('Image'),
+ '&' => array('SpecialCharacter'),
'*' => array('Emphasis'),
- '/' => array('Url'),
- '<' => array('UrlTag', 'EmailTag', 'Tag', 'LessThan'),
+ ':' => array('Url'),
+ '<' => array('UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'),
+ '>' => array('SpecialCharacter'),
'[' => array('Link'),
'_' => array('Emphasis'),
- '`' => array('InlineCode'),
+ '`' => array('Code'),
'~' => array('Strikethrough'),
'\\' => array('EscapeSequence'),
);
# ~
- protected $spanMarkerList = '*_!&[`~\\';
+ protected $inlineMarkerList = '!"*_&[:<>`~\\';
#
# ~
@@ -965,64 +979,65 @@ public function line($text)
{
$markup = '';
- $remainder = $text;
-
- $markerPosition = 0;
+ # $text contains the unexamined text
+ # $excerpt is based on the first occurrence of a marker
- while ($excerpt = strpbrk($remainder, $this->spanMarkerList))
+ while ($excerpt = strpbrk($text, $this->inlineMarkerList))
{
$marker = $excerpt[0];
- $markerPosition += strpos($remainder, $marker);
+ $markerPosition = strpos($text, $marker);
$Excerpt = array('text' => $excerpt, 'context' => $text);
- foreach ($this->SpanTypes[$marker] as $spanType)
+ foreach ($this->InlineTypes[$marker] as $inlineType)
{
- $handler = 'identify'.$spanType;
+ $Inline = $this->{'inline'.$inlineType}($Excerpt);
- $Span = $this->$handler($Excerpt);
-
- if ( ! isset($Span))
+ if ( ! isset($Inline))
{
continue;
}
- # The identified span can be ahead of the marker.
+ # makes sure that the inline belongs to "our" marker
- if (isset($Span['position']) and $Span['position'] > $markerPosition)
+ if (isset($Inline['position']) and $Inline['position'] > $markerPosition)
{
continue;
}
- # Spans that start at the position of their marker don't have to set a position.
+ # sets a default inline position
- if ( ! isset($Span['position']))
+ if ( ! isset($Inline['position']))
{
- $Span['position'] = $markerPosition;
+ $Inline['position'] = $markerPosition;
}
- $plainText = substr($text, 0, $Span['position']);
-
- $markup .= $this->readPlainText($plainText);
+ # the text that comes before the inline
+ $unmarkedText = substr($text, 0, $Inline['position']);
- $markup .= isset($Span['markup']) ? $Span['markup'] : $this->element($Span['element']);
+ # compile the unmarked text
+ $markup .= $this->unmarkedText($unmarkedText);
- $text = substr($text, $Span['position'] + $Span['extent']);
+ # compile the inline
+ $markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']);
- $remainder = $text;
-
- $markerPosition = 0;
+ # remove the examined text
+ $text = substr($text, $Inline['position'] + $Inline['extent']);
continue 2;
}
- $remainder = substr($excerpt, 1);
+ # the marker does not belong to an inline
+
+ $unmarkedText = substr($text, 0, $markerPosition + 1);
- $markerPosition ++;
+ $markup .= $this->unmarkedText($unmarkedText);
+
+ $text = substr($text, $markerPosition + 1);
}
- $markup .= $this->readPlainText($text);
+ $markup .= $this->unmarkedText($text);
return $markup;
}
@@ -1031,63 +1046,83 @@ public function line($text)
# ~
#
- protected function identifyUrl($Excerpt)
+ protected function inlineCode($Excerpt)
{
- if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '/')
- {
- return;
- }
+ $marker = $Excerpt['text'][0];
- if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE))
+ if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(? strlen($matches[0][0]),
- 'position' => $matches[0][1],
+ 'extent' => strlen($matches[0]),
'element' => array(
- 'name' => 'a',
- 'text' => $url,
- 'attributes' => array(
- 'href' => $url,
- ),
+ 'name' => 'code',
+ 'text' => $text,
),
);
}
}
- protected function identifyAmpersand($Excerpt)
+ protected function inlineEmailTag($Excerpt)
{
- if ( ! preg_match('/^?\w+;/', $Excerpt['text']))
+ if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $Excerpt['text'], $matches))
{
+ $url = $matches[1];
+
+ if ( ! isset($matches[2]))
+ {
+ $url = 'mailto:' . $url;
+ }
+
return array(
- 'markup' => '&',
- 'extent' => 1,
+ 'extent' => strlen($matches[0]),
+ 'element' => array(
+ 'name' => 'a',
+ 'text' => $matches[1],
+ 'attributes' => array(
+ 'href' => $url,
+ ),
+ ),
);
}
}
- protected function identifyStrikethrough($Excerpt)
+ protected function inlineEmphasis($Excerpt)
{
if ( ! isset($Excerpt['text'][1]))
{
return;
}
- if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches))
+ $marker = $Excerpt['text'][0];
+
+ if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches))
{
- return array(
- 'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => 'del',
- 'text' => $matches[1],
- 'handler' => 'line',
- ),
- );
+ $emphasis = 'strong';
}
+ elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches))
+ {
+ $emphasis = 'em';
+ }
+ else
+ {
+ return;
+ }
+
+ return array(
+ 'extent' => strlen($matches[0]),
+ 'element' => array(
+ 'name' => $emphasis,
+ 'handler' => 'line',
+ 'text' => $matches[1],
+ ),
+ );
}
- protected function identifyEscapeSequence($Excerpt)
+ protected function inlineEscapeSequence($Excerpt)
{
if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters))
{
@@ -1098,53 +1133,137 @@ protected function identifyEscapeSequence($Excerpt)
}
}
- protected function identifyLessThan()
+ protected function inlineImage($Excerpt)
{
+ if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[')
+ {
+ return;
+ }
+
+ $Excerpt['text']= substr($Excerpt['text'], 1);
+
+ $Link = $this->inlineLink($Excerpt);
+
+ if ($Link === null)
+ {
+ return;
+ }
+
+ $Inline = array(
+ 'extent' => $Link['extent'] + 1,
+ 'element' => array(
+ 'name' => 'img',
+ 'attributes' => array(
+ 'src' => $Link['element']['attributes']['href'],
+ 'alt' => $Link['element']['text'],
+ ),
+ ),
+ );
+
+ $Inline['element']['attributes'] += $Link['element']['attributes'];
+
+ unset($Inline['element']['attributes']['href']);
+
+ return $Inline;
+ }
+
+ protected function inlineLink($Excerpt)
+ {
+ $Element = array(
+ 'name' => 'a',
+ 'handler' => 'line',
+ 'text' => null,
+ 'attributes' => array(
+ 'href' => null,
+ 'title' => null,
+ ),
+ );
+
+ $extent = 0;
+
+ $remainder = $Excerpt['text'];
+
+ if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches))
+ {
+ $Element['text'] = $matches[1];
+
+ $extent += strlen($matches[0]);
+
+ $remainder = substr($remainder, $extent);
+ }
+ else
+ {
+ return;
+ }
+
+ if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
+ {
+ $Element['attributes']['href'] = $matches[1];
+
+ if (isset($matches[2]))
+ {
+ $Element['attributes']['title'] = substr($matches[2], 1, - 1);
+ }
+
+ $extent += strlen($matches[0]);
+ }
+ else
+ {
+ if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
+ {
+ $definition = strlen($matches[1]) ? $matches[1] : $Element['text'];
+ $definition = strtolower($definition);
+
+ $extent += strlen($matches[0]);
+ }
+ else
+ {
+ $definition = strtolower($Element['text']);
+ }
+
+ if ( ! isset($this->DefinitionData['Reference'][$definition]))
+ {
+ return;
+ }
+
+ $Definition = $this->DefinitionData['Reference'][$definition];
+
+ $Element['attributes']['href'] = $Definition['url'];
+ $Element['attributes']['title'] = $Definition['title'];
+ }
+
+ $Element['attributes']['href'] = str_replace(array('&', '<'), array('&', '<'), $Element['attributes']['href']);
+
return array(
- 'markup' => '<',
- 'extent' => 1,
+ 'extent' => $extent,
+ 'element' => $Element,
);
}
- protected function identifyUrlTag($Excerpt)
+ protected function inlineMarkup($Excerpt)
{
- if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(https?:[\/]{2}[^\s]+?)>/i', $Excerpt['text'], $matches))
+ if ($this->markupEscaped or strpos($Excerpt['text'], '>') === false)
{
- $url = str_replace(array('&', '<'), array('&', '<'), $matches[1]);
+ return;
+ }
+ if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $Excerpt['text'], $matches))
+ {
return array(
+ 'markup' => $matches[0],
'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => 'a',
- 'text' => $url,
- 'attributes' => array(
- 'href' => $url,
- ),
- ),
);
}
- }
- protected function identifyEmailTag($Excerpt)
- {
- if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\S+?@\S+?)>/', $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] === '!' and preg_match('/^/s', $Excerpt['text'], $matches))
{
return array(
+ 'markup' => $matches[0],
'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => 'a',
- 'text' => $matches[1],
- 'attributes' => array(
- 'href' => 'mailto:'.$matches[1],
- ),
- ),
);
}
- }
- protected function identifyTag($Excerpt)
- {
- if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<\/?\w.*?>/', $Excerpt['text'], $matches))
+ if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches))
{
return array(
'markup' => $matches[0],
@@ -1153,164 +1272,167 @@ protected function identifyTag($Excerpt)
}
}
- protected function identifyInlineCode($Excerpt)
+ protected function inlineSpecialCharacter($Excerpt)
{
- $marker = $Excerpt['text'][0];
+ if ($Excerpt['text'][0] === '&' and ! preg_match('/^?\w+;/', $Excerpt['text']))
+ {
+ return array(
+ 'markup' => '&',
+ 'extent' => 1,
+ );
+ }
- if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(?' => 'gt', '<' => 'lt', '"' => 'quot');
+
+ if (isset($SpecialCharacter[$Excerpt['text'][0]]))
{
- $text = $matches[2];
- $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
+ return array(
+ 'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';',
+ 'extent' => 1,
+ );
+ }
+ }
+
+ protected function inlineStrikethrough($Excerpt)
+ {
+ if ( ! isset($Excerpt['text'][1]))
+ {
+ return;
+ }
+ if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches))
+ {
return array(
'extent' => strlen($matches[0]),
'element' => array(
- 'name' => 'code',
- 'text' => $text,
+ 'name' => 'del',
+ 'text' => $matches[1],
+ 'handler' => 'line',
),
);
}
}
- protected function identifyLink($Excerpt)
+ protected function inlineUrl($Excerpt)
{
- $extent = $Excerpt['text'][0] === '!' ? 1 : 0;
-
- if (strpos($Excerpt['text'], ']') and preg_match('/\[((?:[^][]|(?R))*)\]/', $Excerpt['text'], $matches))
- {
- $Link = array('text' => $matches[1], 'label' => strtolower($matches[1]));
-
- $extent += strlen($matches[0]);
-
- $substring = substr($Excerpt['text'], $extent);
-
- if (preg_match('/^\s*\[([^][]+)\]/', $substring, $matches))
- {
- $Link['label'] = strtolower($matches[1]);
-
- if (isset($this->Definitions['Reference'][$Link['label']]))
- {
- $Link += $this->Definitions['Reference'][$Link['label']];
-
- $extent += strlen($matches[0]);
- }
- else
- {
- return;
- }
- }
- elseif (isset($this->Definitions['Reference'][$Link['label']]))
- {
- $Link += $this->Definitions['Reference'][$Link['label']];
-
- if (preg_match('/^[ ]*\[\]/', $substring, $matches))
- {
- $extent += strlen($matches[0]);
- }
- }
- elseif (preg_match('/^\([ ]*(.*?)(?:[ ]+[\'"](.+?)[\'"])?[ ]*\)/', $substring, $matches))
- {
- $Link['url'] = $matches[1];
-
- if (isset($matches[2]))
- {
- $Link['title'] = $matches[2];
- }
-
- $extent += strlen($matches[0]);
- }
- else
- {
- return;
- }
- }
- else
+ if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')
{
return;
}
- $url = str_replace(array('&', '<'), array('&', '<'), $Link['url']);
-
- if ($Excerpt['text'][0] === '!')
+ if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE))
{
- $Element = array(
- 'name' => 'img',
- 'attributes' => array(
- 'alt' => $Link['text'],
- 'src' => $url,
+ $Inline = array(
+ 'extent' => strlen($matches[0][0]),
+ 'position' => $matches[0][1],
+ 'element' => array(
+ 'name' => 'a',
+ 'text' => $matches[0][0],
+ 'attributes' => array(
+ 'href' => $matches[0][0],
+ ),
),
);
+
+ return $Inline;
}
- else
+ }
+
+ protected function inlineUrlTag($Excerpt)
+ {
+ if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches))
{
- $Element = array(
- 'name' => 'a',
- 'handler' => 'line',
- 'text' => $Link['text'],
- 'attributes' => array(
- 'href' => $url,
+ $url = str_replace(array('&', '<'), array('&', '<'), $matches[1]);
+
+ return array(
+ 'extent' => strlen($matches[0]),
+ 'element' => array(
+ 'name' => 'a',
+ 'text' => $url,
+ 'attributes' => array(
+ 'href' => $url,
+ ),
),
);
}
+ }
- if (isset($Link['title']))
+ # ~
+
+ protected function unmarkedText($text)
+ {
+ if ($this->breaksEnabled)
+ {
+ $text = preg_replace('/[ ]*\n/', "
\n", $text);
+ }
+ else
{
- $Element['attributes']['title'] = $Link['title'];
+ $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "
\n", $text);
+ $text = str_replace(" \n", "\n", $text);
}
- return array(
- 'extent' => $extent,
- 'element' => $Element,
- );
+ return $text;
}
- protected function identifyEmphasis($Excerpt)
- {
- if ( ! isset($Excerpt['text'][1]))
- {
- return;
- }
+ #
+ # Handlers
+ #
- $marker = $Excerpt['text'][0];
+ protected function element(array $Element)
+ {
+ $markup = '<'.$Element['name'];
- if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches))
+ if (isset($Element['attributes']))
{
- $emphasis = 'strong';
+ foreach ($Element['attributes'] as $name => $value)
+ {
+ if ($value === null)
+ {
+ continue;
+ }
+
+ $markup .= ' '.$name.'="'.$value.'"';
+ }
}
- elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches))
+
+ if (isset($Element['text']))
{
- $emphasis = 'em';
+ $markup .= '>';
+
+ if (isset($Element['handler']))
+ {
+ $markup .= $this->{$Element['handler']}($Element['text']);
+ }
+ else
+ {
+ $markup .= $Element['text'];
+ }
+
+ $markup .= ''.$Element['name'].'>';
}
else
{
- return;
+ $markup .= ' />';
}
- return array(
- 'extent' => strlen($matches[0]),
- 'element' => array(
- 'name' => $emphasis,
- 'handler' => 'line',
- 'text' => $matches[1],
- ),
- );
+ return $markup;
}
- #
- # ~
-
- protected function readPlainText($text)
+ protected function elements(array $Elements)
{
- $breakMarker = $this->breaksEnabled ? "\n" : " \n";
+ $markup = '';
- $text = str_replace($breakMarker, "
\n", $text);
+ foreach ($Elements as $Element)
+ {
+ $markup .= "\n" . $this->element($Element);
+ }
- return $text;
+ $markup .= "\n";
+
+ return $markup;
}
- #
# ~
- #
protected function li($lines)
{
@@ -1332,7 +1454,18 @@ protected function li($lines)
}
#
- # Multiton
+ # Deprecated Methods
+ #
+
+ function parse($text)
+ {
+ $markup = $this->text($text);
+
+ return $markup;
+ }
+
+ #
+ # Static Methods
#
static function instance($name = 'default')
@@ -1351,41 +1484,33 @@ static function instance($name = 'default')
private static $instances = array();
- #
- # Deprecated Methods
- #
-
- /**
- * @deprecated in favor of "text"
- */
- function parse($text)
- {
- $markup = $this->text($text);
-
- return $markup;
- }
-
#
# Fields
#
- protected $Definitions;
+ protected $DefinitionData;
#
- # Read-only
+ # Read-Only
protected $specialCharacters = array(
- '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!',
+ '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|',
);
protected $StrongRegex = array(
- '*' => '/^[*]{2}((?:[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s',
- '_' => '/^__((?:[^_]|_[^_]*_)+?)__(?!_)/us',
+ '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s',
+ '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us',
);
protected $EmRegex = array(
- '*' => '/^[*]((?:[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s',
- '_' => '/^_((?:[^_]|__[^_]*__)+?)_(?!_)\b/us',
+ '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s',
+ '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us',
+ );
+
+ protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?';
+
+ protected $voidElements = array(
+ 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source',
);
protected $textLevelElements = array(
diff --git a/includes/libraries/parsedown/README.md b/includes/libraries/parsedown/README.md
index 40c9065..0498523 100644
--- a/includes/libraries/parsedown/README.md
+++ b/includes/libraries/parsedown/README.md
@@ -1,18 +1,22 @@
## Parsedown
-Better [Markdown](http://en.wikipedia.org/wiki/Markdown) parser for PHP.
+[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown)
+
-[[ demo ]](http://parsedown.org/demo)
+Better Markdown Parser in PHP
+
+[Demo](http://parsedown.org/demo) |
+[Benchmarks](http://parsedown.org/speed) |
+[Tests](http://parsedown.org/tests/) |
+[Documentation](https://github.com/erusev/parsedown/wiki/)
### Features
-* [Fast](http://parsedown.org/speed)
-* [Consistent](http://parsedown.org/consistency)
-* [GitHub Flavored](https://help.github.com/articles/github-flavored-markdown)
-* [Tested](http://parsedown.org/tests/) in PHP 5.2, 5.3, 5.4, 5.5, 5.6 and [hhvm](http://www.hhvm.com/)
+* Super Fast
+* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
* Extensible
-* [Markdown Extra extension](https://github.com/erusev/parsedown-extra) new
-* [JavaScript port](https://github.com/hkdobrev/parsedown.js) under development new
+* Tested in 5.3 to 5.6
+* [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
### Installation
@@ -26,18 +30,24 @@ $Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!'); # prints:
Hello Parsedown!
``` -More examples in [the wiki](https://github.com/erusev/parsedown/wiki/Usage) and in [this video tutorial](http://youtu.be/wYZBY8DEikI). +More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI). ### Questions -**How does Parsedown work?**sparse:
+<div> +<div class="inner"> +content +</div> +</div>
+paragraph
+<style type="text/css"> +p { +color: red; +} +</style>
+comment
+<!-- html comment -->
+EXPECTED_HTML; + $parsedownWithNoMarkup = new Parsedown(); + $parsedownWithNoMarkup->setMarkupEscaped(true); + $this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml)); + } +} diff --git a/includes/libraries/parsedown/test/Test.php b/includes/libraries/parsedown/test/Test.php deleted file mode 100644 index 5171d84..0000000 --- a/includes/libraries/parsedown/test/Test.php +++ /dev/null @@ -1,65 +0,0 @@ -dataDir = dirname(__FILE__).'/data/'; - - parent::__construct($name, $data, $dataName); - } - - private $dataDir; - - /** - * @dataProvider data - */ - function test_($filename) - { - $markdown = file_get_contents($this->dataDir . $filename . '.md'); - - $expectedMarkup = file_get_contents($this->dataDir . $filename . '.html'); - - $expectedMarkup = str_replace("\r\n", "\n", $expectedMarkup); - $expectedMarkup = str_replace("\r", "\n", $expectedMarkup); - - $actualMarkup = Parsedown::instance()->text($markdown); - - $this->assertEquals($expectedMarkup, $actualMarkup); - } - - function data() - { - $data = array(); - - $Folder = new DirectoryIterator($this->dataDir); - - foreach ($Folder as $File) - { - /** @var $File DirectoryIterator */ - - if ( ! $File->isFile()) - { - continue; - } - - $filename = $File->getFilename(); - - $extension = pathinfo($filename, PATHINFO_EXTENSION); - - if ($extension !== 'md') - { - continue; - } - - $basename = $File->getBasename('.md'); - - if (file_exists($this->dataDir . $basename . '.html')) - { - $data []= array($basename); - } - } - - return $data; - } -} diff --git a/includes/libraries/parsedown/test/data/aligned_table.html b/includes/libraries/parsedown/test/data/aligned_table.html index 0657bd1..c4acfcb 100644 --- a/includes/libraries/parsedown/test/data/aligned_table.html +++ b/includes/libraries/parsedown/test/data/aligned_table.html @@ -1,21 +1,21 @@header 1 | -header 2 | -header 2 | +header 1 | +header 2 | +header 2 |
---|---|---|---|---|---|
cell 1.1 | -cell 1.2 | -cell 1.3 | +cell 1.1 | +cell 1.2 | +cell 1.3 |
cell 2.1 | -cell 2.2 | -cell 2.3 | +cell 2.1 | +cell 2.2 | +cell 2.3 |
####### not a heading
#
\ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/atx_heading.md b/includes/libraries/parsedown/test/data/atx_heading.md index 5339a5b..ad97b44 100644 --- a/includes/libraries/parsedown/test/data/atx_heading.md +++ b/includes/libraries/parsedown/test/data/atx_heading.md @@ -10,7 +10,7 @@ ###### h6 -####### h6 +####### not a heading # closed h1 # diff --git a/includes/libraries/parsedown/test/data/block-level_html.html b/includes/libraries/parsedown/test/data/block-level_html.html index 86ff865..6443a4a 100644 --- a/includes/libraries/parsedown/test/data/block-level_html.html +++ b/includes/libraries/parsedown/test/data/block-level_html.html @@ -1,13 +1,12 @@sparse:
+paragraph
paragraph
\ No newline at end of file + p {color: #789;} + +escaped *emphasis*.
escaped \*emphasis\* in a code span
escaped \*emphasis\* in a code block
-\ ` * _ { } [ ] ( ) > # + - . !
\ No newline at end of file +\ ` * _ { } [ ] ( ) > # + - . !
+one_two one_two
+one*two one*two
\ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/escaping.md b/includes/libraries/parsedown/test/data/escaping.md index 164039f..9f174e9 100644 --- a/includes/libraries/parsedown/test/data/escaping.md +++ b/includes/libraries/parsedown/test/data/escaping.md @@ -4,4 +4,8 @@ escaped \*emphasis\*. escaped \*emphasis\* in a code block -\\ \` \* \_ \{ \} \[ \] \( \) \> \# \+ \- \. \! \ No newline at end of file +\\ \` \* \_ \{ \} \[ \] \( \) \> \# \+ \- \. \! + +_one\_two_ __one\_two__ + +*one\*two* **one\*two** \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/HTML_Comment.html b/includes/libraries/parsedown/test/data/html_comment.html similarity index 100% rename from includes/libraries/parsedown/test/data/HTML_Comment.html rename to includes/libraries/parsedown/test/data/html_comment.html diff --git a/includes/libraries/parsedown/test/data/HTML_Comment.md b/includes/libraries/parsedown/test/data/html_comment.md similarity index 100% rename from includes/libraries/parsedown/test/data/HTML_Comment.md rename to includes/libraries/parsedown/test/data/html_comment.md diff --git a/includes/libraries/parsedown/test/data/image_reference.html b/includes/libraries/parsedown/test/data/image_reference.html index b3249cb..67fbd2c 100644 --- a/includes/libraries/parsedown/test/data/image_reference.html +++ b/includes/libraries/parsedown/test/data/image_reference.html @@ -1 +1,2 @@ - \ No newline at end of file + +![missing reference]
\ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/image_reference.md b/includes/libraries/parsedown/test/data/image_reference.md index dcb1414..1e11d94 100644 --- a/includes/libraries/parsedown/test/data/image_reference.md +++ b/includes/libraries/parsedown/test/data/image_reference.md @@ -1,3 +1,5 @@ ![Markdown Logo][image] [image]: /md.png + +![missing reference] \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/image_title.html b/includes/libraries/parsedown/test/data/image_title.html index 82c155f..957c950 100644 --- a/includes/libraries/parsedown/test/data/image_title.html +++ b/includes/libraries/parsedown/test/data/image_title.html @@ -1 +1,2 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/image_title.md b/includes/libraries/parsedown/test/data/image_title.md index 3e58ee5..7ce2849 100644 --- a/includes/libraries/parsedown/test/data/image_title.md +++ b/includes/libraries/parsedown/test/data/image_title.md @@ -1 +1,3 @@ -![alt](/md.png "title") \ No newline at end of file +![alt](/md.png "title") + +![blank title](/md.png "") \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/inline_link.html b/includes/libraries/parsedown/test/data/inline_link.html index 2b9e649..5ad564a 100644 --- a/includes/libraries/parsedown/test/data/inline_link.html +++ b/includes/libraries/parsedown/test/data/inline_link.html @@ -1,4 +1,6 @@ -link and another link
+ +link with parentheses in URL
+(link) in parentheses
- - \ No newline at end of file + + \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/inline_link.md b/includes/libraries/parsedown/test/data/inline_link.md index cd8e5a6..6bac0b3 100644 --- a/includes/libraries/parsedown/test/data/inline_link.md +++ b/includes/libraries/parsedown/test/data/inline_link.md @@ -1,4 +1,8 @@ -[link](http://example.com) and [another link](/tests/) +[link](http://example.com) + +[link](/url-(parentheses)) with parentheses in URL + +([link](/index.php)) in parentheses [`link`](http://example.com) diff --git a/includes/libraries/parsedown/test/data/inline_link_title.html b/includes/libraries/parsedown/test/data/inline_link_title.html index 70e589a..ecdfd03 100644 --- a/includes/libraries/parsedown/test/data/inline_link_title.html +++ b/includes/libraries/parsedown/test/data/inline_link_title.html @@ -1 +1,6 @@ -single quotes and double quotes
\ No newline at end of file + + + + + + \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/inline_link_title.md b/includes/libraries/parsedown/test/data/inline_link_title.md index 162b832..6e1c5af 100644 --- a/includes/libraries/parsedown/test/data/inline_link_title.md +++ b/includes/libraries/parsedown/test/data/inline_link_title.md @@ -1 +1,11 @@ -[single quotes](http://example.com 'Title') and [double quotes](http://example.com "Title") \ No newline at end of file +[single quotes](http://example.com 'Title') + +[double quotes](http://example.com "Title") + +[single quotes blank](http://example.com '') + +[double quotes blank](http://example.com "") + +[space](http://example.com "2 Words") + +[parentheses](http://example.com/url-(parentheses) "Title") \ No newline at end of file diff --git a/includes/libraries/parsedown/test/data/simple_table.html b/includes/libraries/parsedown/test/data/simple_table.html index 64b7a9a..237d7ef 100644 --- a/includes/libraries/parsedown/test/data/simple_table.html +++ b/includes/libraries/parsedown/test/data/simple_table.html @@ -20,17 +20,17 @@header 1 | +header 1 | header 2 | |
---|---|---|---|
cell 1.1 | +cell 1.1 | cell 1.2 | |
cell 2.1 | +cell 2.1 | cell 2.2 | |
cell 2.1 |
-cell 2.2 | +| 2.1 |
+| 2.2 | +
\| 2.1 |
+link |