From cef15510ea63c4f66aebaa5b70faea930bb677d3 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 14 Apr 2024 07:48:46 +0300 Subject: [PATCH] filter link tag on line construct --- src/Gemtext/Link.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Gemtext/Link.php b/src/Gemtext/Link.php index a479257..6557391 100644 --- a/src/Gemtext/Link.php +++ b/src/Gemtext/Link.php @@ -10,12 +10,18 @@ class Link public function __construct(string $line) { - $this->_line = $line; + $this->_line = preg_replace( + '/^\s*=>(.*)/', + '$1', + trim( + $line + ) + ); } public function getAddress(): ?string { - if (preg_match('/^=>\s*([^\s]+)/', trim($this->_line), $match)) + if (preg_match('/^\s*([^\s]+)/', trim($this->_line), $match)) { return trim( $match[1]