mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-06-02 14:02:18 +02:00
Merge pull request #67 from KnpLabs/fix/double-escaping
[RFR] Fix double escaping
This commit is contained in:
commit
1384e05693
|
@ -37,7 +37,7 @@ class MarkdownParser extends MarkdownExtra implements MarkdownParserInterface
|
||||||
'html_block' => true,
|
'html_block' => true,
|
||||||
'auto_link' => true,
|
'auto_link' => true,
|
||||||
'auto_mailto' => true,
|
'auto_mailto' => true,
|
||||||
'entities' => false,
|
'entities' => true,
|
||||||
'no_html' => false,
|
'no_html' => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -101,10 +101,10 @@ class MarkdownParser extends MarkdownExtra implements MarkdownParserInterface
|
||||||
if (!$this->features['auto_link']) {
|
if (!$this->features['auto_link']) {
|
||||||
unset($this->span_gamut['doAutoLinks']);
|
unset($this->span_gamut['doAutoLinks']);
|
||||||
}
|
}
|
||||||
if (!$this->features['entities'] && !$this->features['no_html']) {
|
if (false === $this->features['entities']) {
|
||||||
$this->no_entities = true;
|
$this->no_entities = true;
|
||||||
}
|
}
|
||||||
if ($this->features['no_html']) {
|
if (true === $this->features['no_html']) {
|
||||||
$this->no_html = true;
|
$this->no_html = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -792,4 +792,26 @@ EOF;
|
||||||
|
|
||||||
$this->assertEquals($html, $parser->transform($text));
|
$this->assertEquals($html, $parser->transform($text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testParser
|
||||||
|
*/
|
||||||
|
public function testParagraphContainingBoldContainingAmpersandEscapesProperly($parser) {
|
||||||
|
$text = "Look ma! I can use **beautiful & bold** text with ampersands.";
|
||||||
|
|
||||||
|
$expectedResult = "<p>Look ma! I can use <strong>beautiful & bold</strong> text with ampersands.</p>\n";
|
||||||
|
|
||||||
|
$this->assertEquals($expectedResult, $parser->transform($text));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testParser
|
||||||
|
*/
|
||||||
|
public function testEscapedLink($parser) {
|
||||||
|
$link = "http://images.google.com/images?num=30&q=larry+bird";
|
||||||
|
|
||||||
|
$expectedResult = "<p>http://images.google.com/images?num=30&q=larry+bird</p>\n";
|
||||||
|
|
||||||
|
$this->assertEquals($expectedResult, $parser->transform($link));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
"symfony/framework-bundle": "~2.1",
|
"symfony/framework-bundle": "~2.1",
|
||||||
"michelf/php-markdown": "1.4.*"
|
"michelf/php-markdown": "1.4.*"
|
||||||
},
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.5"
|
||||||
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/twig-bundle": "to use the Twig markdown filter",
|
"symfony/twig-bundle": "to use the Twig markdown filter",
|
||||||
"ext-sundown": "to use optional support for php-sundown extension instead of php implementation"
|
"ext-sundown": "to use optional support for php-sundown extension instead of php implementation"
|
||||||
|
|
Loading…
Reference in a new issue