diff --git a/README.md b/README.md index 65ec485..54f4190 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ $body = new \Yggverse\Gemini\Gemtext\Body( #### Body::getH1 #### Body::getH2 #### Body::getH3 +#### Body::getQuote #### Body::getLinks ``` php diff --git a/src/Gemtext/Body.php b/src/Gemtext/Body.php index 0ce16d0..4c6f721 100644 --- a/src/Gemtext/Body.php +++ b/src/Gemtext/Body.php @@ -94,6 +94,23 @@ class Body return $matches; } + public function getQuote(): array + { + $matches = []; + + foreach ($this->_lines as $index => $line) + { + if (preg_match('/^>(.*)/', trim($line), $match)) + { + $matches[$index] = trim( + $match[1] + ); + } + } + + return $matches; + } + public function findLinks(string $protocol = 'gemini'): array { $matches = [];