Migrate mistune to markdown

This commit is contained in:
cuom1999 2022-10-24 23:59:04 -05:00
parent 412945626b
commit 77aaae6735
46 changed files with 5112 additions and 420 deletions

View file

@ -57,6 +57,7 @@
<link rel="stylesheet" type="text/css" href="{{ static('libs/clipboard/tooltip.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('libs/select2/select2.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('icofont/icofont.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('markdown.css') }}">
{% endcompress %}
<link rel="canonical"
href="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}">

View file

@ -36,7 +36,7 @@
</div>
<div class="body content-description">
{% cache 86400 'post_content' post.id MATH_ENGINE %}
{{ post.content|markdown('blog', MATH_ENGINE)|reference|str|safe}}
{{ post.content|markdown|reference|str|safe}}
{% endcache %}
</div>
</div>

View file

@ -38,7 +38,7 @@
</h2>
<div class="summary content-description blog-description">
{% cache 86400 'post_summary' post.id %}
{{ post.summary|default(post.content, true)|markdown('blog', 'svg', lazy_load=True)|reference|str|safe }}
{{ post.summary|default(post.content, true)|markdown|reference|str|safe }}
{% endcache %}
</div>
</section>

View file

@ -1 +1 @@
{{ preview_data|markdown('blog', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}

View file

@ -66,7 +66,6 @@ let META_HEADER = [
}
$('.body-block').slice(0, window.messages_per_page).each(function() {
resize_emoji($(this));
});
register_time($('.time-with-rel'));
@ -153,7 +152,6 @@ let META_HEADER = [
function add_message(data) {
var $data = $(data);
resize_emoji($data.find('.body-block'));
$('#chat-log').append($data);
$('#chat-box').scrollTop($('#chat-box')[0].scrollHeight);
@ -212,7 +210,6 @@ let META_HEADER = [
else {
add_new_message(message, room, true);
}
resize_emoji($body_block);
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
register_time($('.time-with-rel'));
remove_unread_current_user();
@ -439,10 +436,6 @@ let META_HEADER = [
});
{% endif %}
$('.body-block').each(function() {
resize_emoji($(this));
});
$("#chat-log").show();
$("#chat-log").change(function() {
$('#chat-log').scrollTop($('#chat-log')[0].scrollHeight);

View file

@ -21,7 +21,7 @@
</a>
{% endif %}
<div class="message-text message-text-other">
{{message.body | markdown('comment', MATH_ENGINE, hard_wrap=True)|reference|str|safe }}
{{message.body|markdown(hard_wrap=True)|reference|str|safe }}
</div>
</div>
</span>

View file

@ -1 +1 @@
{{ comment.body|markdown('comment', MATH_ENGINE)|reference|str|safe }}
{{ comment.body|markdown|reference|str|safe }}

View file

@ -13,6 +13,6 @@
{% endif %}
{% endwith %}
<div class='blog-description content-description'>
{{ comment.body |markdown("comment", MATH_ENGINE)|reference|str|safe }}
{{ comment.body |markdown|reference|str|safe }}
</div>
</div>

View file

@ -93,7 +93,7 @@
</div>
<div class="content content-description">
<div class="comment-body"{% if node.score <= vote_hide_threshold %} style="display:none"{% endif %}>
{{ node.body|markdown('comment', MATH_ENGINE, True)|reference|str|safe }}
{{ node.body|markdown|reference|str|safe }}
</div>
{% if node.score <= vote_hide_threshold %}
<div class="comment-body bad-comment-body">

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('comment', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -1,3 +1,3 @@
{% with node=revision.field_dict %}
<div class="comment-body">{{ node.body|markdown('comment', MATH_ENGINE)|reference|str|safe }}</div>
<div class="comment-body">{{ node.body|markdown|reference|str|safe }}</div>
{% endwith %}

View file

@ -69,7 +69,7 @@
<div class="content-description">
{% cache 3600 'contest_html' contest.id MATH_ENGINE %}
{{ contest.description|markdown('contest', MATH_ENGINE)|reference|str|safe }}
{{ contest.description|markdown|reference|str|safe }}
{% endcache %}
</div>

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('contest', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -4,4 +4,4 @@
<hr>
{% endif %}
{{ tag.description|markdown('contest_tag') }}
{{ tag.description|markdown }}

View file

@ -10,5 +10,5 @@
{% block header %}{% include "flatpages/admin_link.html" %}{% endblock %}
{% block body %}
<div class="content-description">{{ flatpage.content|markdown('solution')|reference|str|safe }}</div>
<div class="content-description">{{ flatpage.content|markdown|reference|str|safe }}</div>
{% endblock %}

View file

@ -1,7 +1,7 @@
{% extends "flatpages/markdown.html" %}
{% block body %}
<div class="content-description">{{ flatpage.content|markdown('solution', MATH_ENGINE)|reference }}</div>
<div class="content-description">{{ flatpage.content|markdown|reference }}</div>
{% endblock %}
{% block bodyend %}

View file

@ -1 +1 @@
{{ preview_data|markdown('license') }}
{{ preview_data|markdown }}

View file

@ -1,7 +1,7 @@
{% extends "common-content.html" %}
{% block description %}
{% cache 3600 'license_html' license.id %}
{{ license.text|markdown('license') }}
{{ license.text|markdown }}
{% endcache %}
{% endblock %}

View file

@ -39,7 +39,7 @@
<div class="sidebox-content">
<div style="margin: 0.3em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
{{ organization.about|markdown|reference|str|safe }}
{% endcache %}
</div>
</div>

View file

@ -71,7 +71,7 @@
<div class="sidebox-content">
<div style="margin: 0.3em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
{{ organization.about|markdown|reference|str|safe }}
{% endcache %}
</div>
</div>

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -26,7 +26,7 @@
<p>Authors: {{ link_users(authors) }}</p>
{% endif %}
{% endwith %}
{{ solution.content|markdown('solution', MATH_ENGINE)|reference|str|safe }}
{{ solution.content|markdown|reference|str|safe }}
</div>
<hr>
{% include "comments/list.html" %}

View file

@ -54,7 +54,7 @@
{% endif %}
<div class='blog-description content-description'>
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{{ problem.description|markdown("problem", MATH_ENGINE)|reference|str|safe }}
{{ problem.description|markdown|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}
<embed src="{{url('problem_pdf_description', problem.code)}}" width="100%" height="500" type="application/pdf" style="margin-top: 0.5em">

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('problem', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -376,7 +376,7 @@
{% endif %}
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{{ description|markdown("problem", MATH_ENGINE)|reference|str|safe }}
{{ description|markdown|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}
@ -426,7 +426,7 @@
<div class="problem-clarification">
<div class="time">{{ relative_time(clarification.date) }}</div>
<span class="body">
{{ clarification.description|markdown('problem', MATH_ENGINE)|reference }}
{{ clarification.description|markdown|reference }}
</span>
</div>
{% endfor %}

View file

@ -3,8 +3,11 @@
<head>
<link rel="stylesheet" href="{{ static('style.css') }}">
<link rel="stylesheet" href="{{ static('pygment-github.css') }}" type="text/css">
<link rel="stylesheet" href="{{ static('markdown.css') }}">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="pygment-github.css" type="text/css">
<link rel="stylesheet" href="markdown.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html {
@ -87,7 +90,7 @@
</div>
<hr style="clear: both;">
<div class="content-description printing">
{{ description|markdown('problem', 'tex')|reference|absolutify(url)|str|safe }}
{{ description|markdown|reference|absolutify(url)|str|safe }}
</div>
<script type="text/javascript" src="{{ static('mathjax_config.js') }}"></script>

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('solution', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -47,7 +47,7 @@
{% if language.description %}
<div class="content-description">
{% cache 86400 'language_html' language.id %}
{{ language.description|markdown('language') }}
{{ language.description|markdown }}
{% endcache %}
</div>
{% endif %}

View file

@ -20,6 +20,6 @@
{{link_user(ticket.messages.last().user)}} {{_(' replied')}}
</div>
<div class='blog-description content-description'>
{{ ticket.messages.last().body |markdown("ticket", MATH_ENGINE)|reference|str|safe }}
{{ ticket.messages.last().body |markdown|reference|str|safe }}
</div>
</div>

View file

@ -16,7 +16,7 @@
</div>
</div>
<div class="content content-description">
{{ message.body|markdown('ticket', MATH_ENGINE)|reference|str|safe }}
{{ message.body|markdown|reference|str|safe }}
</div>
</div>
</section>

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('ticket', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown('self-description', MATH_ENGINE)|reference|str|safe }}
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -82,7 +82,7 @@
{% if user.about %}
<h4>{{ _('About') }}</h4>
{% cache 86400 'user_about' user.id MATH_ENGINE %}
{{ user.about|markdown('self-description', MATH_ENGINE)|reference|str|safe }}
{{ user.about|markdown|reference|str|safe }}
{% endcache %}
{% else %}
<i>

View file

@ -38,7 +38,7 @@
<div class="about-td">
{% if user.about %}
{% cache 86400 'user_about' user.id MATH_ENGINE %}
{{ user.about|markdown('self-description', MATH_ENGINE)|reference|str|safe }}
{{ user.about|markdown|reference|str|safe }}
{% endcache %}
{% endif %}
</div>