Fixing CSS class regex.
This commit is contained in:
parent
4a48b4648c
commit
9983ec342f
1 changed files with 8 additions and 2 deletions
10
markdown.php
10
markdown.php
|
|
@ -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] : '');
|
||||
|
|
|
|||
Loading…
Reference in a new issue