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)
|
if ($post['txid'] == $quote)
|
||||||
{
|
{
|
||||||
// Strip folding
|
// Strip folding
|
||||||
$quote =
|
$quote = '>' .
|
||||||
trim(
|
trim(
|
||||||
preg_replace(
|
preg_replace(
|
||||||
'/^@([A-z0-9]{64})/',
|
'/^@([A-z0-9]{64})/',
|
||||||
null,
|
null,
|
||||||
$post['value']
|
// Add quote after each new line
|
||||||
)
|
str_replace(
|
||||||
|
PHP_EOL,
|
||||||
|
PHP_EOL . '>',
|
||||||
|
// Ignore markup
|
||||||
|
$this->_plain(
|
||||||
|
$post['value']
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'>'
|
||||||
);
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -270,7 +279,13 @@ class Room
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove mention from message
|
// 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[1]
|
||||||
),
|
),
|
||||||
'@' . $matches[2],
|
'@' . $matches[2],
|
||||||
trim(
|
$quote
|
||||||
$quote
|
,
|
||||||
),
|
$this->_plain(
|
||||||
trim(
|
|
||||||
$record['value']
|
$record['value']
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -380,4 +394,23 @@ class Room
|
|||||||
|
|
||||||
return $texts[(($number % 100) > 4 && ($number % 100) < 20) ? 2 : $cases[min($number % 10, 5)]];
|
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}
|
## {author}
|
||||||
> {quote}
|
{quote}
|
||||||
{message}
|
{message}
|
||||||
```
|
```
|
||||||
{time} #{txid}
|
{time} #{txid}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user