diff options
author | Max Kostikov <max@kostikov.co> | 2019-08-08 18:19:07 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-08-08 18:19:07 +0200 |
commit | 2300581c93d0f40b1972774e05f493332729a948 (patch) | |
tree | 9e23e57643132a6602e797c8898f2986cf399aa7 /include | |
parent | 75a8b209f5fdda7d1c8a636be5cf35ecf264af4f (diff) | |
download | volse-hubzilla-2300581c93d0f40b1972774e05f493332729a948.tar.gz volse-hubzilla-2300581c93d0f40b1972774e05f493332729a948.tar.bz2 volse-hubzilla-2300581c93d0f40b1972774e05f493332729a948.zip |
Catch and exclude trailing punctuation while URL embedding
Diffstat (limited to 'include')
-rw-r--r-- | include/zid.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/zid.php b/include/zid.php index 27ef0cefa..344976437 100644 --- a/include/zid.php +++ b/include/zid.php @@ -205,6 +205,10 @@ function zidify_text($s) { */ function red_zrl_callback($matches) { + // Catch and exclude trailing punctuation + if (preg_match("/[.,;:!?)]*$/i", $matches[2], $pts)) + $matches[2] = substr($matches[2], 0, strlen($matches[2])-strlen($pts[0])); + $zrl = is_matrix_url($matches[2]); $t = strip_zids($matches[2]); @@ -215,10 +219,11 @@ function red_zrl_callback($matches) { if($matches[1] === '#^') $matches[1] = ''; + if($zrl) - return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]'; + return $matches[1] . '#^[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]' . $pts[0]; - return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]'; + return $matches[1] . '#^[url=' . $matches[2] . ']' . $matches[2] . '[/url]' . $pts[0]; } /** |