Merge branch 'master' into extra
This commit is contained in:
commit
0ea71037e3
1 changed files with 12 additions and 11 deletions
23
markdown.php
23
markdown.php
|
|
@ -1264,20 +1264,21 @@ class Markdown_Parser {
|
|||
|
||||
|
||||
function encodeAmpsAndAngles($text) {
|
||||
# Smart processing for ampersands and angle brackets that need to be encoded.
|
||||
#
|
||||
# Smart processing for ampersands and angle brackets that need to
|
||||
# be encoded. Valid character entities are left alone unless the
|
||||
# no-entities mode is set.
|
||||
#
|
||||
if ($this->no_entities) {
|
||||
$text = str_replace('&', '&', $text);
|
||||
$text = str_replace('<', '<', $text);
|
||||
return $text;
|
||||
} else {
|
||||
# Ampersand-encoding based entirely on Nat Irons's Amputator
|
||||
# MT plugin: <http://bumppo.net/projects/amputator/>
|
||||
$text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
|
||||
'&', $text);;
|
||||
}
|
||||
|
||||
# Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
|
||||
# http://bumppo.net/projects/amputator/
|
||||
$text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
|
||||
'&', $text);;
|
||||
|
||||
# Encode naked <'s
|
||||
$text = preg_replace('{<(?![a-z/?\$!%])}i', '<', $text);
|
||||
# Encode remaining <'s
|
||||
$text = str_replace('<', '<', $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue