mirror of
https://github.com/typecho/typecho.git
synced 2025-04-15 07:13:05 +02:00
修正解析顺序
This commit is contained in:
parent
627e5cf54e
commit
12c4b8fe98
@ -1,4 +1,4 @@
|
||||
// Generated by CoffeeScript 1.11.1
|
||||
// Generated by CoffeeScript 1.12.1
|
||||
(function() {
|
||||
var Parser,
|
||||
slice = [].slice;
|
||||
@ -212,6 +212,13 @@
|
||||
enableAutoLink = true;
|
||||
}
|
||||
text = this.call('beforeParseInline', text);
|
||||
text = text.replace(/(^|[^\\])(`+)(.+?)\2/mg, (function(_this) {
|
||||
return function() {
|
||||
var matches;
|
||||
matches = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||
return matches[1] + _this.makeHolder('<code>' + (htmlspecialchars(matches[3])) + '</code>');
|
||||
};
|
||||
})(this));
|
||||
text = text.replace(/\\(.)/g, (function(_this) {
|
||||
return function() {
|
||||
var escaped, matches;
|
||||
@ -221,13 +228,6 @@
|
||||
return _this.makeHolder(escaped);
|
||||
};
|
||||
})(this));
|
||||
text = text.replace(/(^|[^\\])(`+)(.+?)\2/mg, (function(_this) {
|
||||
return function() {
|
||||
var matches;
|
||||
matches = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||
return matches[1] + _this.makeHolder('<code>' + (htmlspecialchars(matches[3])) + '</code>');
|
||||
};
|
||||
})(this));
|
||||
text = text.replace(/<(https?:\/\/.+)>/ig, (function(_this) {
|
||||
return function() {
|
||||
var link, matches, url;
|
||||
|
@ -242,18 +242,7 @@ class HyperDown
|
||||
public function parseInline($text, $whiteList = '', $clearHolders = true, $enableAutoLink = true)
|
||||
{
|
||||
$self = $this;
|
||||
$text = $this->call('beforeParseInline', $text);
|
||||
|
||||
// escape
|
||||
$text = preg_replace_callback(
|
||||
"/\\\(.)/u",
|
||||
function ($matches) use ($self) {
|
||||
$escaped = htmlspecialchars($matches[1]);
|
||||
$escaped = str_replace('$', '$', $escaped);
|
||||
return $self->makeHolder($escaped);
|
||||
},
|
||||
$text
|
||||
);
|
||||
$text = $this->call('beforeParseInline', $text);
|
||||
|
||||
// code
|
||||
$text = preg_replace_callback(
|
||||
@ -266,6 +255,17 @@ class HyperDown
|
||||
$text
|
||||
);
|
||||
|
||||
// escape
|
||||
$text = preg_replace_callback(
|
||||
"/\\\(.)/u",
|
||||
function ($matches) use ($self) {
|
||||
$escaped = htmlspecialchars($matches[1]);
|
||||
$escaped = str_replace('$', '$', $escaped);
|
||||
return $self->makeHolder($escaped);
|
||||
},
|
||||
$text
|
||||
);
|
||||
|
||||
// link
|
||||
$text = preg_replace_callback(
|
||||
"/<(https?:\/\/.+)>/i",
|
||||
|
Loading…
x
Reference in New Issue
Block a user