mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-09 23:48:41 +00:00
feat(web/user_info/motto): markdown support
This commit is contained in:
parent
8579e31c19
commit
60ba1a5829
@ -107,7 +107,7 @@
|
||||
<label for="input-motto" class="col-sm-2 control-label"><?= UOJLocale::get('motto') ?></label>
|
||||
<div class="col-sm-3">
|
||||
<textarea class="form-control" id="input-motto" name="motto"><?=HTML::escape($myUser['motto'])?></textarea>
|
||||
<span class="help-block" id="help-motto"></span>
|
||||
<span class="help-block" id="help-motto">格言支持 Markdown 语法。</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -59,7 +59,7 @@
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<h4 class="list-group-item-heading"><?= UOJLocale::get('motto') ?></h4>
|
||||
<div class="list-group-item-text"><?= HTML::purifier_inline()->purify($user['motto']) ?></div>
|
||||
<div class="list-group-item-text"><?= HTML::purifier_inline()->purify(HTML::parsedown()->line($user['motto'])) ?></div>
|
||||
</div>
|
||||
|
||||
<?php if (isSuperUser($myUser)): ?>
|
||||
|
@ -1357,9 +1357,10 @@ function echoRanklist($config = array()) {
|
||||
$header_row .= '<th style="width: 5em;">'.UOJLocale::get('solved').'</th>';
|
||||
$header_row .= '</tr>';
|
||||
|
||||
$parsedown = HTML::parsedown();
|
||||
$purifier = HTML::purifier_inline();
|
||||
$users = array();
|
||||
$print_row = function($user, $now_cnt) use (&$users, $config, $purifier) {
|
||||
$print_row = function($user, $now_cnt) use (&$users, $config, $purifier, $parsedown) {
|
||||
if (!$users) {
|
||||
if ($now_cnt == 1) {
|
||||
$rank = 1;
|
||||
@ -1376,7 +1377,7 @@ function echoRanklist($config = array()) {
|
||||
echo '<td>' . $user['rank'] . '</td>';
|
||||
echo '<td>' . getUserLink($user['username']) . '</td>';
|
||||
echo "<td>";
|
||||
echo $purifier->purify($user['motto']);
|
||||
echo $purifier->purify($parsedown->line($user['motto']));
|
||||
echo "</td>";
|
||||
echo '<td>' . $user['ac_num'] . '</td>';
|
||||
echo '</tr>';
|
||||
|
@ -191,4 +191,13 @@ class HTML {
|
||||
|
||||
return new HTMLPurifier($config);
|
||||
}
|
||||
|
||||
public static function parsedown() {
|
||||
return new ParsedownMath([
|
||||
'math' => [
|
||||
'enabled' => true,
|
||||
'matchSingleDollar' => true
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -102,12 +102,7 @@ class UOJBlogEditor {
|
||||
$this->post_data['is_hidden'] = isset($_POST["{$this->name}_is_hidden"]) ? 1 : 0;
|
||||
|
||||
$purifier = HTML::purifier();
|
||||
$parsedown = new ParsedownMath([
|
||||
'math' => [
|
||||
'enabled' => true,
|
||||
'matchSingleDollar' => true
|
||||
]
|
||||
]);
|
||||
$parsedown = HTML::parsedown();
|
||||
|
||||
$this->post_data['title'] = HTML::escape($this->post_data['title']);
|
||||
|
||||
|
@ -82,7 +82,7 @@ function fTime($time, $gran = -1) {
|
||||
</span>
|
||||
</h3>
|
||||
<div class="card-text">
|
||||
<?= HTML::purifier_inline()->purify($user['motto']) ?>
|
||||
<?= HTML::purifier_inline()->purify(HTML::parsedown()->line($user['motto'])) ?>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
|
Loading…
Reference in New Issue
Block a user