Skip to content

Commit

Permalink
Add open parentheses to cite regex
Browse files Browse the repository at this point in the history
Allows cite regex to match a post number after an opening parenthesis. "I like the comfy threads (>>1 and >>2) because they're comfy"
From fallenPineapple@d78254b
  • Loading branch information
discomrade authored Jan 12, 2023
1 parent 23163ae commit 5d31f3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2086,7 +2086,7 @@ function markup(&$body, $track_cites = false, $op = false) {
$tracked_cites = array();

// Cites
if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)((?=[\s,.)?!])|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
if (isset($board) && preg_match_all('/(^|[\s(])>>(\d+?)((?=[\s,.)?!])|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
if (count($cites[0]) > $config['max_cites']) {
error($config['error']['toomanycites']);
}
Expand Down Expand Up @@ -2133,7 +2133,7 @@ function markup(&$body, $track_cites = false, $op = false) {
}

// Cross-board linking
if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?((?=[\s,.)?!])|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
if (preg_match_all('/(^|[\s(])>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?((?=[\s,.)?!])|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
if (count($cites[0]) > $config['max_cites']) {
error($config['error']['toomanycross']);
}
Expand Down

0 comments on commit 5d31f3b

Please sign in to comment.