63 lines
2.2 KiB
Twig
63 lines
2.2 KiB
Twig
<div class="blog-post-wrap2">
|
|
<div class="blog-post-wrap1">
|
|
<div class="blog-post">
|
|
{{ bc([{url: '/articles/?lang='~selected_lang, text: "articles"|lang}]) }}
|
|
<div class="blog-post-title">
|
|
<h1>{{ pt.title }}</h1>
|
|
<div class="blog-post-date">
|
|
{% if not post.visible %}
|
|
{{ ("blog_post_hidden"|lang)~" |" }}
|
|
{% endif %}
|
|
{{ post.getFullDate() }}
|
|
{% if other_langs %}
|
|
{% for l in other_langs %}
|
|
| <a href="{{ post.getUrl() }}{% if l != 'en' %}?lang={{ l }}{% endif %}">{{ ("blog_read_in_"~l)|lang }}</a>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if post.hasSourceUrl() %}
|
|
| <a href="{{ post.sourceUrl }}">Source at kiwi arXiv</a>
|
|
{% endif %}
|
|
{% if is_admin %}
|
|
| <a href="{{ post.getUrl() }}edit/?lang={{ selected_lang }}">{{ "edit"|lang }}</a>
|
|
| <a href="{{ post.getUrl() }}delete/?token={{ delete_token }}" onclick="return confirm('{{ "blog_post_delete_confirmation"|lang }}')">{{ "delete"|lang }}</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="blog-post-text">{{ html|raw }}</div>
|
|
</div>
|
|
{% if pt.hasTableOfContents() %}
|
|
<div class="blog-post-toc">
|
|
<div class="blog-post-toc-wrap">
|
|
<div class="blog-post-toc-inner-wrap">
|
|
<div class="blog-post-toc-title">{{ "toc"|lang }}</div>
|
|
{{ pt.getTableOfContentsHtml()|raw }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% js %}
|
|
ThemeSwitcher.addOnChangeListener(function(isDark) {
|
|
var nodes = document.querySelectorAll('.md-image-wrap');
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
var node = nodes[i];
|
|
var alpha = parseInt(node.getAttribute('data-alpha'), 10);
|
|
if (!alpha)
|
|
continue;
|
|
var div = node.querySelector('a > div');
|
|
if (!div) {
|
|
console.warn('could not found a>div on this node:', node);
|
|
continue;
|
|
}
|
|
var style = div.getAttribute('style');
|
|
if (isDark) {
|
|
style = style.replace(/(a[\d]+x[\d]+)\.jpg/, '$1_dark.jpg');
|
|
} else {
|
|
style = style.replace(/(a[\d]+x[\d]+)_dark\.jpg/, '$1.jpg');
|
|
}
|
|
div.setAttribute('style', style);
|
|
}
|
|
});
|
|
{% endjs %} |