Merge branch 'dev' into 'dev'
Catch and exclude trailing punctuation while URL embedding See merge request hubzilla/core!1701
This commit is contained in:
commit
699aad8626
@ -205,20 +205,25 @@ function zidify_text($s) {
|
|||||||
*/
|
*/
|
||||||
function red_zrl_callback($matches) {
|
function red_zrl_callback($matches) {
|
||||||
|
|
||||||
$zrl = is_matrix_url($matches[2]);
|
// Catch and exclude trailing punctuation
|
||||||
|
preg_match("/[.,;:!?)]*$/i", $matches[2], $pts);
|
||||||
$t = strip_zids($matches[2]);
|
$matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0]));
|
||||||
if($t !== $matches[2]) {
|
|
||||||
$zrl = true;
|
$zrl = is_matrix_url($matches[2]);
|
||||||
$matches[2] = $t;
|
|
||||||
}
|
$t = strip_zids($matches[2]);
|
||||||
|
if($t !== $matches[2]) {
|
||||||
if($matches[1] === '#^')
|
$zrl = true;
|
||||||
$matches[1] = '';
|
$matches[2] = $t;
|
||||||
if($zrl)
|
}
|
||||||
return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]';
|
|
||||||
|
if($matches[1] === '#^')
|
||||||
return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]';
|
$matches[1] = '';
|
||||||
|
|
||||||
|
if($zrl)
|
||||||
|
return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0];
|
||||||
|
|
||||||
|
return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user