mirror of
https://github.com/YGGverse/gemtext-php.git
synced 2026-04-01 02:05:32 +00:00
implement Code::escaped method
This commit is contained in:
parent
63d810b9fe
commit
1cd973f9a0
1 changed files with 23 additions and 0 deletions
23
src/Code.php
Normal file
23
src/Code.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Gemtext;
|
||||||
|
|
||||||
|
class Code
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Helper method
|
||||||
|
*
|
||||||
|
* Detect line given is escaped by previous iteration
|
||||||
|
*/
|
||||||
|
public static function escaped(string $line, bool &$status): bool
|
||||||
|
{
|
||||||
|
if (preg_match('/^```/m', $line))
|
||||||
|
{
|
||||||
|
$status = !($status); // toggle
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue