fix(web): style
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-18 08:55:56 +08:00
parent 2da9633b01
commit 652cd00b86
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -20,16 +20,16 @@ class UOJMarkdown extends ParsedownMath {
// https://github.com/taufik-nurrohman/parsedown-extra-plugin/blob/1653418c5a9cf5277cd28b0b23ba2d95d18e9bc4/ParsedownExtraPlugin.php#L347-L358 // https://github.com/taufik-nurrohman/parsedown-extra-plugin/blob/1653418c5a9cf5277cd28b0b23ba2d95d18e9bc4/ParsedownExtraPlugin.php#L347-L358
protected function doGetContent($Element) { protected function doGetContent($Element) {
if (isset($Element['text'])) { if (isset($Element['text'])) {
return $Element['text']; return $Element['text'];
} }
if (isset($Element['rawHtml'])) { if (isset($Element['rawHtml'])) {
return $Element['rawHtml']; return $Element['rawHtml'];
} }
if (isset($Element['handler']['argument'])) { if (isset($Element['handler']['argument'])) {
return implode("\n", (array) $Element['handler']['argument']); return implode("\n", (array) $Element['handler']['argument']);
} }
return null; return null;
} }
// https://github.com/taufik-nurrohman/parsedown-extra-plugin/blob/1653418c5a9cf5277cd28b0b23ba2d95d18e9bc4/ParsedownExtraPlugin.php#L369-L378 // https://github.com/taufik-nurrohman/parsedown-extra-plugin/blob/1653418c5a9cf5277cd28b0b23ba2d95d18e9bc4/ParsedownExtraPlugin.php#L369-L378
@ -54,25 +54,25 @@ class UOJMarkdown extends ParsedownMath {
// https://gist.github.com/ShNURoK42/b5ce8baa570975db487c // https://gist.github.com/ShNURoK42/b5ce8baa570975db487c
protected function inlineUserMention($Excerpt) { protected function inlineUserMention($Excerpt) {
if (preg_match('/^@([^\s]+)/', $Excerpt['text'], $matches)) { if (preg_match('/^@([^\s]+)/', $Excerpt['text'], $matches)) {
if (validateUsername($matches[1]) && ($user = queryUser($matches[1]))) { if (validateUsername($matches[1]) && ($user = queryUser($matches[1]))) {
return [ return [
'extent' => strlen($matches[0]), 'extent' => strlen($matches[0]),
'element' => [ 'element' => [
'name' => 'a', 'name' => 'a',
'text' => '@' . $user['username'], 'text' => '@' . $user['username'],
'attributes' => [ 'attributes' => [
'href' => '/user/' . $user['username'], 'href' => '/user/' . $user['username'],
'class' => 'uoj-username', 'class' => 'uoj-username',
'data-realname' => $user['realname'], 'data-realname' => $user['realname'],
], ],
], ],
]; ];
} }
return [ return [
'extent' => strlen($matches[0]), 'extent' => strlen($matches[0]),
'markup' => $matches[0], 'markup' => $matches[0],
]; ];
} }
} }
} }