mirror of
https://github.com/typecho/typecho.git
synced 2025-04-15 07:13:05 +02:00
update hyperdown
This commit is contained in:
parent
ac74c6e0cb
commit
50c23c44c5
8
.github/workflows/Typecho-dev-Ci.yml
vendored
8
.github/workflows/Typecho-dev-Ci.yml
vendored
@ -1,6 +1,12 @@
|
||||
name: Typecho Build Dev Ci
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
php:
|
||||
|
File diff suppressed because one or more lines are too long
@ -406,12 +406,12 @@
|
||||
text = this.parseInlineCallback(text);
|
||||
text = text.replace(/<([_a-z0-9-\.\+]+@[^@]+\.[a-z]{2,})>/ig, '<a href="mailto:$1">$1</a>');
|
||||
if (enableAutoLink) {
|
||||
text = text.replace(/(^|[^\"])((https?):\S+)($|[^\"])/ig, (function(_this) {
|
||||
text = text.replace(/(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*))($|[^\"])/g, (function(_this) {
|
||||
return function() {
|
||||
var link, matches;
|
||||
matches = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||
link = _this.call('parseLink', matches[2]);
|
||||
return matches[1] + "<a href=\"" + matches[2] + "\">" + link + "</a>" + matches[4];
|
||||
return matches[1] + "<a href=\"" + matches[2] + "\">" + link + "</a>" + matches[5];
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
@ -1139,9 +1139,9 @@
|
||||
|
||||
Parser.prototype.cleanUrl = function(url) {
|
||||
var matches;
|
||||
if (!!(matches = url.match(/^\s*((http|https|ftp|mailto):\S+)/i))) {
|
||||
if (!!(matches = url.match(/^\s*(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*))/))) {
|
||||
return matches[1];
|
||||
} else if (!!(matches = url.match(/^\s*(\S+)/))) {
|
||||
} else if (!!(matches = url.match(/^\s*([-a-zA-Z0-9()@:%_\+.~#?&\/=]+)/))) {
|
||||
return matches[1];
|
||||
} else {
|
||||
return '#';
|
||||
|
@ -537,10 +537,10 @@ class HyperDown
|
||||
// autolink url
|
||||
if ($enableAutoLink) {
|
||||
$text = preg_replace_callback(
|
||||
"/(^|[^\"])((https?):\S+)($|[^\"])/i",
|
||||
"/(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*))($|[^\"])/",
|
||||
function ($matches) use ($self) {
|
||||
$link = $self->call('parseLink', $matches[2]);
|
||||
return "{$matches[1]}<a href=\"{$matches[2]}\">{$link}</a>{$matches[4]}";
|
||||
return "{$matches[1]}<a href=\"{$matches[2]}\">{$link}</a>{$matches[5]}";
|
||||
},
|
||||
$text
|
||||
);
|
||||
@ -1627,9 +1627,9 @@ class HyperDown
|
||||
*/
|
||||
public function cleanUrl($url)
|
||||
{
|
||||
if (preg_match("/^\s*((http|https|ftp|mailto):\S+)/i", $url, $matches)) {
|
||||
if (preg_match("/^\s*(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*))/", $url, $matches)) {
|
||||
return $matches[1];
|
||||
} elseif (preg_match("/^\s*(\S+)/i", $url, $matches)) {
|
||||
} elseif (preg_match("/^\s*([-a-zA-Z0-9()@:%_\+.~#?&\/=]+)/", $url, $matches)) {
|
||||
return $matches[1];
|
||||
} else {
|
||||
return '#';
|
||||
|
Loading…
x
Reference in New Issue
Block a user