mirror of
https://github.com/kevachat/geminiapp.git
synced 2025-03-13 05:51:39 +00:00
add document format filters
This commit is contained in:
parent
55ffa4634a
commit
537706f39c
@ -256,13 +256,22 @@ class Room
|
||||
if ($post['txid'] == $quote)
|
||||
{
|
||||
// Strip folding
|
||||
$quote =
|
||||
$quote = '>' .
|
||||
trim(
|
||||
preg_replace(
|
||||
'/^@([A-z0-9]{64})/',
|
||||
null,
|
||||
$post['value']
|
||||
)
|
||||
// Add quote after each new line
|
||||
str_replace(
|
||||
PHP_EOL,
|
||||
PHP_EOL . '>',
|
||||
// Ignore markup
|
||||
$this->_plain(
|
||||
$post['value']
|
||||
)
|
||||
)
|
||||
),
|
||||
'>'
|
||||
);
|
||||
|
||||
break;
|
||||
@ -270,7 +279,13 @@ class Room
|
||||
}
|
||||
|
||||
// Remove mention from message
|
||||
$record['value'] = preg_replace('/^@([A-z0-9]{64})/', null, $record['value']);
|
||||
$record['value'] = preg_replace(
|
||||
'/^@([A-z0-9]{64})/',
|
||||
null,
|
||||
$this->_plain(
|
||||
$record['value']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,10 +307,9 @@ class Room
|
||||
$matches[1]
|
||||
),
|
||||
'@' . $matches[2],
|
||||
trim(
|
||||
$quote
|
||||
),
|
||||
trim(
|
||||
$quote
|
||||
,
|
||||
$this->_plain(
|
||||
$record['value']
|
||||
)
|
||||
],
|
||||
@ -380,4 +394,23 @@ class Room
|
||||
|
||||
return $texts[(($number % 100) > 4 && ($number % 100) < 20) ? 2 : $cases[min($number % 10, 5)]];
|
||||
}
|
||||
|
||||
private function _plain(string $value)
|
||||
{
|
||||
return trim(
|
||||
str_replace(
|
||||
[
|
||||
'#',
|
||||
'##',
|
||||
'###',
|
||||
'>',
|
||||
'*',
|
||||
'```',
|
||||
'=>',
|
||||
],
|
||||
null,
|
||||
$value
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
## {author}
|
||||
> {quote}
|
||||
{quote}
|
||||
{message}
|
||||
```
|
||||
{time} #{txid}
|
||||
|
Loading…
x
Reference in New Issue
Block a user