mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
commit
9f968d134e
3 changed files with 66 additions and 1 deletions
|
@ -32,6 +32,8 @@
|
|||
- Update AP helpers, adjust RemoteAvatarFetch ttl from 24h to 3 months ([36b23fe3](https://github.com/pixelfed/pixelfed/commit/36b23fe3))
|
||||
- Update AvatarPipeline, improve refresh logic and garbage collection to purge old avatars ([82798b5e](https://github.com/pixelfed/pixelfed/commit/82798b5e))
|
||||
- Update CreateAvatar job, add processing constraints and set `is_remote` attribute ([319ced40](https://github.com/pixelfed/pixelfed/commit/319ced40))
|
||||
- Update RemoteStatusDelete and DecrementPostCount pipelines ([edbcf3ed](https://github.com/pixelfed/pixelfed/commit/edbcf3ed))
|
||||
- Update lexer regex, fix mention regex and add more tests ([778e83d3](https://github.com/pixelfed/pixelfed/commit/778e83d3))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)
|
||||
|
|
|
@ -162,7 +162,7 @@ abstract class Regex
|
|||
// look-ahead capture here and don't append $after when we return.
|
||||
$tmp['valid_mention_preceding_chars'] = '([^a-zA-Z0-9_!#\$%&*@@\/]|^|(?:^|[^a-z0-9_+~.-])RT:?)';
|
||||
|
||||
$re['valid_mentions_or_lists'] = '/'.$tmp['valid_mention_preceding_chars'].'(['.$tmp['at_signs'].'])([a-z0-9_\-.]{1,20})((\/[a-z][a-z0-9_\-]{0,24})?(?=(.*|$))(?:@[a-z0-9\.\-]+[a-z0-9]+)?)/i';
|
||||
$re['valid_mentions_or_lists'] = '/'.$tmp['valid_mention_preceding_chars'].'(['.$tmp['at_signs'].'])([\p{L}0-9_\-.]{1,20})((\/[a-z][a-z0-9_\-]{0,24})?(?=(.*|$))(?:@[a-z0-9\.\-]+[a-z0-9]+)?)/iu';
|
||||
|
||||
$re['valid_reply'] = '/^(?:['.$tmp['spaces'].'])*['.$tmp['at_signs'].']([a-z0-9_\-.]{1,20})(?=(.*|$))/iu';
|
||||
$re['end_mention_match'] = '/\A(?:['.$tmp['at_signs'].']|['.$tmp['latin_accents'].']|:\/\/)/iu';
|
||||
|
|
|
@ -175,4 +175,67 @@ class UsernameTest extends TestCase
|
|||
$this->assertEquals($expectedEntity, $entities);
|
||||
}
|
||||
|
||||
/** @test * */
|
||||
public function germanUmlatsAutolink()
|
||||
{
|
||||
$mentions = "@März and @königin and @Glück";
|
||||
$autolink = Autolink::create()->autolink($mentions);
|
||||
|
||||
$expectedAutolink = '<a class="u-url mention" href="https://pixelfed.dev/März" rel="external nofollow noopener" target="_blank">@März</a> and <a class="u-url mention" href="https://pixelfed.dev/königin" rel="external nofollow noopener" target="_blank">@königin</a> and <a class="u-url mention" href="https://pixelfed.dev/Glück" rel="external nofollow noopener" target="_blank">@Glück</a>';
|
||||
$this->assertEquals($expectedAutolink, $autolink);
|
||||
}
|
||||
|
||||
/** @test * */
|
||||
public function germanUmlatsExtractor()
|
||||
{
|
||||
$mentions = "@März and @königin and @Glück";
|
||||
$entities = Extractor::create()->extract($mentions);
|
||||
|
||||
$expectedEntity = [
|
||||
"hashtags" => [],
|
||||
"urls" => [],
|
||||
"mentions" => [
|
||||
"märz",
|
||||
"königin",
|
||||
"glück",
|
||||
],
|
||||
"replyto" => null,
|
||||
"hashtags_with_indices" => [],
|
||||
"urls_with_indices" => [],
|
||||
"mentions_with_indices" => [
|
||||
[
|
||||
"screen_name" => "März",
|
||||
"indices" => [
|
||||
0,
|
||||
5,
|
||||
],
|
||||
],
|
||||
[
|
||||
"screen_name" => "königin",
|
||||
"indices" => [
|
||||
10,
|
||||
18,
|
||||
],
|
||||
],
|
||||
[
|
||||
"screen_name" => "Glück",
|
||||
"indices" => [
|
||||
23,
|
||||
29,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
$this->assertEquals($expectedEntity, $entities);
|
||||
}
|
||||
|
||||
/** @test * */
|
||||
public function germanUmlatsWebfingerAutolink()
|
||||
{
|
||||
$mentions = "hello @märz@example.org!";
|
||||
$autolink = Autolink::create()->autolink($mentions);
|
||||
|
||||
$expectedAutolink = 'hello <a class="u-url list-slug" href="https://pixelfed.dev/@märz@example.org" rel="external nofollow noopener" target="_blank">@märz@example.org</a>!';
|
||||
$this->assertEquals($expectedAutolink, $autolink);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue