From fc8ccf10ab9d74f86524ba5d20edc812047f441b Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 4 Mar 2024 23:22:00 +0200 Subject: [PATCH] remove extra-rules --- src/server.php | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/server.php b/src/server.php index ffa63ad..cba7f8d 100644 --- a/src/server.php +++ b/src/server.php @@ -554,33 +554,19 @@ $server->setHandler( ); // Value - $lines = []; - - foreach ((array) explode(PHP_EOL, (string) $record['value']) as $line) - { - $lines[] = preg_replace( - [ - '/(^|\s+)(#|\*|```|=>)/', // escape gemini text - ], - [ - '$1 $2', - ], - $line - ); - } - $result[] = null; $result[] = trim( preg_replace( [ - '/[\n\r]{3,}/', // remove extra breaks + '/(^|\s+)(#|\*|```|=>)/', // escape gemini text + '/[\n\r]{3,}/', // remove extra breaks ], [ + '$1 $2', PHP_EOL . PHP_EOL, ], - implode( - PHP_EOL, - $lines + trim( + $record['value'] ) ) );