Fixing CSS class regex.

This commit is contained in:
Corey Worrell 2012-01-14 18:59:13 -08:00
parent 4a48b4648c
commit 9983ec342f

View file

@ -2554,7 +2554,7 @@ class MarkdownExtra_Parser extends Markdown_Parser {
)
# 2: CSS classes
\s?(\.[^\n]+)?
[ ]*(\.[^\n]+)?
[ ]* \n # Whitespace and newline following marker.
@ -2570,7 +2570,7 @@ class MarkdownExtra_Parser extends Markdown_Parser {
\1
# 4: CSS classes
\s?(\.[^\n]+)?
[ ]*(\.[^\n]+)?
# End of line
[ ]* \n
@ -2582,6 +2582,12 @@ class MarkdownExtra_Parser extends Markdown_Parser {
function _doFencedCodeBlocks_callback($matches) {
$codeblock = $matches[3];
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
/*
Newlines must be replaced with <br />'s because otherwise extra tabs and spaces will
be shown depending on where the Markdown'ed content appears in the HTML source. This
ensures that code blocks are only a single line in the HTML source and no extra
spaces can appear.
*/
$codeblock = preg_replace_callback('/\n+/',
array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
$class = ! empty($matches[2]) ? $matches[2] : ( ! empty($matches[4]) ? $matches[4] : '');