first commit

This commit is contained in:
Digital Studium 2023-07-22 16:18:15 +03:00
commit 5be1e9acaa
25 changed files with 476 additions and 0 deletions

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2023 YOUR_NAME_HERE
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# DigitalStudium theme
For Crater static site generator

6
i18n.csv Normal file
View File

@ -0,0 +1,6 @@
id|en|ru
by|by|автор
published|published|опубликовано
readmore|read more|читать дальше
next|next|вперёд
prev|previous|назад
1 id en ru
2 by by автор
3 published published опубликовано
4 readmore read more читать дальше
5 next next вперёд
6 prev previous назад

180
static/css/style.css Normal file
View File

@ -0,0 +1,180 @@
* {
word-wrap: break-word;
font-family: 'Open Sans', sans-serif;
}
html {
background-color: #f2f2f2
}
article,
section {
font-size: 1.3rem !important;
padding: 1.5rem;
margin-bottom: 1rem;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, .2), 0 6px 20px 0 rgba(0, 0, 0, .19);
background-color: white;
overflow: auto
}
pre {
margin: 0 !important;
border-radius: 0 !important;
padding: .7rem !important;
font-weight: 500;
overflow: auto
}
blockquote {
font-family: Lato;
font-size: 1.2rem;
line-height: 1.5;
color: #555;
text-align: left;
border-left: 4px solid #ccc;
padding: 1rem;
margin: 1rem 0;
background-color: #f8f8f8;
}
.copy-code-button {
cursor: pointer;
display: block;
margin: 1rem 0 -2px auto;
font-size: 1.1rem !important
}
button {
padding: 0.5rem;
border: 0.1;
}
/* images settings */
/* img {
max-width: 100%;
height: auto
} */
.post-image,
.home-image {
float: left;
padding-right: 1rem;
}
.post-image {
width: 50%;
}
.home-image {
width: 30%;
}
/* Блок для правильной вёрстки аудио/видео начало */
/* Применяем max-width для замещаемых элементов и контролов формы. */
img,
video,
audio,
canvas,
input,
select,
button,
progress {
max-width: 100%;
}
/* Заставляем поля с типом file и submit переносить текст */
input[type="file"],
input[type="submit"] {
white-space: pre-wrap;
}
/* Чиним прогрессбар и поле-ползунок */
progress,
input[type="range"] {
width: 100%;
}
/* Фиксим поля с типом Number в Firefox */
@supports (--moz-appearance: none) {
input[type="number"] {
width: 100%;
}
}
/* Блок для аудио/видео конец */
@media screen and (max-width:50em) {
.home-image {
width: 50%;
}
.sidebar {
display: none
}
}
/* gird settings */
body {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(6, 1fr);
}
header,
footer,
main {
grid-column-start: 2;
}
.social-icons {
grid-column-start: 3;
grid-column-end: 5;
justify-self: end;
}
footer,
main {
grid-column-end: 5
}
.sidebar {
grid-column-start: 5;
grid-column-end: 6
}
main,
.sidebar {
grid-row-start: 2
}
@media screen and (max-width:100em) {
header,
footer,
main {
grid-column-start: 1
}
footer,
.sidebar {
grid-column-end: 7
}
header {
grid-column-end: 3
}
}
@media screen and (max-width:50em) {
header,
main {
grid-column-end: 7
}
}

1
static/images/github.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="800" width="1200" viewBox="-72.03675 -32.46875 624.3185 194.8125"><path d="M92.497 55.588H52.141a1.887 1.887 0 00-1.886 1.887v19.73c0 1.042.845 1.888 1.886 1.888h15.743v24.515s-3.535 1.204-13.308 1.204c-11.53 0-27.636-4.212-27.636-39.63 0-35.426 16.772-40.087 32.517-40.087 13.63 0 19.502 2.4 23.238 3.556 1.174.358 2.26-.81 2.26-1.851l4.502-19.064c0-.488-.165-1.075-.72-1.473C87.22 5.18 77.963 0 54.576 0 27.636 0 0 11.463 0 66.563c0 55.101 31.64 63.312 58.303 63.312 22.076 0 35.468-9.434 35.468-9.434.552-.304.612-1.076.612-1.429V57.475a1.886 1.886 0 00-1.886-1.887M300.475 6.602a1.88 1.88 0 00-1.873-1.897h-22.723a1.889 1.889 0 00-1.881 1.897l.005 43.914h-35.418V6.602c0-1.05-.836-1.897-1.876-1.897h-22.722a1.888 1.888 0 00-1.876 1.897v118.904c0 1.048.843 1.902 1.876 1.902h22.722c1.04 0 1.876-.854 1.876-1.902v-50.86h35.418l-.061 50.86c0 1.048.841 1.902 1.883 1.902H298.6c1.04 0 1.872-.854 1.874-1.902zM135.376 22.205c0-8.181-6.56-14.793-14.653-14.793-8.085 0-14.65 6.612-14.65 14.793 0 8.174 6.565 14.804 14.65 14.804 8.093 0 14.653-6.63 14.653-14.804m-1.625 78.219V45.537c0-1.041-.84-1.893-1.88-1.893h-22.65c-1.04 0-1.97 1.07-1.97 2.113v78.636c0 2.31 1.44 2.998 3.304 2.998h20.408c2.239 0 2.788-1.1 2.788-3.035zm253.081-56.602h-22.548c-1.035 0-1.876.852-1.876 1.902v58.301s-5.73 4.192-13.86 4.192c-8.13 0-10.288-3.69-10.288-11.65V45.723c0-1.05-.84-1.902-1.875-1.902H313.5c-1.032 0-1.879.852-1.879 1.902v54.692c0 23.646 13.179 29.432 31.308 29.432 14.875 0 26.867-8.218 26.867-8.218s.57 4.331.83 4.844c.257.512.93 1.03 1.658 1.03l14.559-.064c1.032 0 1.878-.854 1.878-1.899l-.008-79.817c0-1.05-.842-1.902-1.881-1.902m52.736 64.324c-7.822-.239-13.127-3.787-13.127-3.787V66.703s5.233-3.208 11.655-3.781c8.12-.727 15.944 1.725 15.944 21.096 0 20.425-3.53 24.457-14.472 24.127m8.893-66.994c-12.807 0-21.517 5.715-21.517 5.715V6.602c0-1.05-.84-1.897-1.875-1.897h-22.788a1.887 1.887 0 00-1.877 1.897v118.904c0 1.05.841 1.903 1.88 1.903h15.81c.712 0 1.251-.368 1.65-1.011.393-.639.96-5.481.96-5.481s9.317 8.829 26.956 8.829c20.71 0 32.585-10.504 32.585-47.155 0-36.65-18.968-41.44-31.784-41.44m-249.403 2.482h-17.045l-.026-22.519c0-.852-.438-1.278-1.425-1.278h-23.227c-.902 0-1.388.398-1.388 1.266v23.27s-11.64 2.809-12.426 3.037a1.886 1.886 0 00-1.362 1.812v14.623c0 1.05.84 1.9 1.879 1.9h11.91v35.178c0 26.128 18.327 28.695 30.694 28.695 5.652 0 12.412-1.815 13.528-2.227.675-.248 1.068-.946 1.068-1.704l.019-16.086c0-1.05-.887-1.9-1.884-1.9-.994 0-3.535.405-6.151.405-8.372 0-11.21-3.892-11.21-8.93V65.743h17.046a1.89 1.89 0 001.881-1.9V45.528c0-1.05-.842-1.895-1.881-1.895" fill="#0F0E0F"/></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="800" width="1200" viewBox="-36 -60 312 360"><defs><linearGradient gradientUnits="userSpaceOnUse" y2="51.9" y1="11.536" x2="28.836" x1="46.136" id="a"><stop offset="0" stop-color="#37aee2"/><stop offset="1" stop-color="#1e96c8"/></linearGradient></defs><g transform="scale(3.4682)"><circle fill="url(#a)" r="34.6" cx="34.6" cy="34.6"/><path fill="#fff" d="M14.4 34.3l23.3-9.6c2.3-1 10.1-4.2 10.1-4.2s3.6-1.4 3.3 2c-.1 1.4-.9 6.3-1.7 11.6l-2.5 15.7s-.2 2.3-1.9 2.7c-1.7.4-4.5-1.4-5-1.8-.4-.3-7.5-4.8-10.1-7-.7-.6-1.5-1.8.1-3.2 3.6-3.3 7.9-7.4 10.5-10 1.2-1.2 2.4-4-2.6-.6l-14.1 9.5s-1.6 1-4.6.1c-3-.9-6.5-2.1-6.5-2.1s-2.4-1.5 1.7-3.1z"/></g></svg>

After

Width:  |  Height:  |  Size: 693 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="800" width="1200" xml:space="preserve" y="0" x="0" id="Layer_1" version="1.1" viewBox="-57.15 -21.25 495.3 127.5"><style id="style7427" type="text/css">.st2{fill:#282828}</style><g id="g7433"><path id="path7429" d="M118.9 13.3c-1.4-5.2-5.5-9.3-10.7-10.7C98.7 0 60.7 0 60.7 0s-38 0-47.5 2.5C8.1 3.9 3.9 8.1 2.5 13.3 0 22.8 0 42.5 0 42.5s0 19.8 2.5 29.2C3.9 76.9 8 81 13.2 82.4 22.8 85 60.7 85 60.7 85s38 0 47.5-2.5c5.2-1.4 9.3-5.5 10.7-10.7 2.5-9.5 2.5-29.2 2.5-29.2s.1-19.8-2.5-29.3z" fill="red"/><path id="polygon7431" fill="#fff" d="M48.6 24.3v36.4l31.6-18.2z"/></g><g id="g7451"><g id="g7449"><path id="path7435" d="M176.3 77.4c-2.4-1.6-4.1-4.1-5.1-7.6-1-3.4-1.5-8-1.5-13.6v-7.7c0-5.7.6-10.3 1.7-13.8 1.2-3.5 3-6 5.4-7.6 2.5-1.6 5.7-2.4 9.7-2.4 3.9 0 7.1.8 9.5 2.4 2.4 1.6 4.1 4.2 5.2 7.6 1.1 3.4 1.7 8 1.7 13.8v7.7c0 5.7-.5 10.2-1.6 13.7-1.1 3.4-2.8 6-5.2 7.6-2.4 1.6-5.7 2.4-9.8 2.4-4.2-.1-7.6-.9-10-2.5zm13.5-8.4c.7-1.7 1-4.6 1-8.5V43.9c0-3.8-.3-6.6-1-8.4-.7-1.8-1.8-2.6-3.5-2.6-1.6 0-2.8.9-3.4 2.6-.7 1.8-1 4.6-1 8.4v16.6c0 3.9.3 6.8 1 8.5.6 1.7 1.8 2.6 3.5 2.6 1.6 0 2.7-.8 3.4-2.6z" class="st2"/><path id="path7437" d="M360.9 56.3V59c0 3.4.1 6 .3 7.7.2 1.7.6 3 1.3 3.7.6.8 1.6 1.2 3 1.2 1.8 0 3-.7 3.7-2.1.7-1.4 1-3.7 1.1-7l10.3.6c.1.5.1 1.1.1 1.9 0 4.9-1.3 8.6-4 11-2.7 2.4-6.5 3.6-11.4 3.6-5.9 0-10-1.9-12.4-5.6-2.4-3.7-3.6-9.4-3.6-17.2v-9.3c0-8 1.2-13.8 3.7-17.5 2.5-3.7 6.7-5.5 12.6-5.5 4.1 0 7.3.8 9.5 2.3 2.2 1.5 3.7 3.9 4.6 7 .9 3.2 1.3 7.6 1.3 13.2v9.1h-20.1zm1.5-22.4c-.6.8-1 2-1.2 3.7-.2 1.7-.3 4.3-.3 7.8v3.8h8.8v-3.8c0-3.4-.1-6-.3-7.8-.2-1.8-.7-3-1.3-3.7-.6-.7-1.6-1.1-2.8-1.1-1.4-.1-2.3.3-2.9 1.1z" class="st2"/><path id="path7439" d="M147.1 55.3L133.5 6h11.9l4.8 22.3c1.2 5.5 2.1 10.2 2.7 14.1h.3c.4-2.8 1.3-7.4 2.7-14l5-22.4h11.9L159 55.3v23.6h-11.8V55.3z" class="st2"/><path id="path7441" d="M241.6 25.7V79h-9.4l-1-6.5h-.3c-2.5 4.9-6.4 7.4-11.5 7.4-3.5 0-6.1-1.2-7.8-3.5-1.7-2.3-2.5-5.9-2.5-10.9V25.7h12v39.1c0 2.4.3 4.1.8 5.1s1.4 1.5 2.6 1.5c1 0 2-.3 3-1 1-.6 1.7-1.4 2.1-2.4V25.7z" class="st2"/><path id="path7443" d="M303.1 25.7V79h-9.4l-1-6.5h-.3c-2.5 4.9-6.4 7.4-11.5 7.4-3.5 0-6.1-1.2-7.8-3.5-1.7-2.3-2.5-5.9-2.5-10.9V25.7h12v39.1c0 2.4.3 4.1.8 5.1s1.4 1.5 2.6 1.5c1 0 2-.3 3-1 1-.6 1.7-1.4 2.1-2.4V25.7z" class="st2"/><path id="path7445" d="M274.2 15.7h-11.9v63.2h-11.7V15.7h-11.9V6h35.5z" class="st2"/><path id="path7447" d="M342.8 34.2c-.7-3.4-1.9-5.8-3.5-7.3s-3.9-2.3-6.7-2.3c-2.2 0-4.3.6-6.2 1.9-1.9 1.2-3.4 2.9-4.4 4.9h-.1V3.3h-11.6v75.6h9.9l1.2-5h.3c.9 1.8 2.3 3.2 4.2 4.3 1.9 1 3.9 1.6 6.2 1.6 4.1 0 7-1.9 8.9-5.6 1.9-3.7 2.9-9.6 2.9-17.5v-8.4c-.1-6.1-.4-10.8-1.1-14.1zm-11 21.7c0 3.9-.2 6.9-.5 9.1-.3 2.2-.9 3.8-1.6 4.7-.8.9-1.8 1.4-3 1.4-1 0-1.9-.2-2.7-.7-.8-.5-1.5-1.2-2-2.1V38.1c.4-1.4 1.1-2.6 2.1-3.6 1-.9 2.1-1.4 3.2-1.4 1.2 0 2.2.5 2.8 1.4.7 1 1.1 2.6 1.4 4.8.3 2.3.4 5.5.4 9.6v7z" class="st2"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

File diff suppressed because one or more lines are too long

58
static/js/copy.js Normal file
View File

@ -0,0 +1,58 @@
function addCopyButtons(clipboard) {
document.querySelectorAll('pre').forEach(function (preElement) {
// Создание кнопки
var button = document.createElement('button');
button.className = 'copy-code-button';
button.type = 'button';
var lang = document.documentElement.lang;
var button_text = "Copy";
var button_text_copied = "Copied!";
if (lang == "ru") {
button_text = "Копировать";
button_text_copied = "Скопировано!";
}
button.innerText = button_text;
// Добавление слушателя к кнопке
button.addEventListener('click', function () {
clipboard.writeText(preElement.innerText).then(function () {
/* Chrome doesn't seem to blur automatically,
leaving the button in a focused state. */
button.blur();
if (lang == "ru-RU") {
button_text = "Копировать";
button_text_copied = "Скопировано!";
}
button.innerText = button_text_copied;
setTimeout(function () {
button.innerText = button_text;
}, 1000);
}, function (error) {
button.innerText = 'Error';
});
});
// wrapper.appendChild(preElement);
var preParent = preElement.parentNode;
if (preParent.classList.contains('highlight') && preElement.children[0].dataset.lang != 'plaintext') {
preParent.parentNode.insertBefore(button, preParent);
}
});
}
if (navigator && navigator.clipboard) {
addCopyButtons(navigator.clipboard);
} else {
var script = document.createElement('script');
script.src = '/js/clipboard-polyfill.promise.js';
script.onload = function() {
addCopyButtons(clipboard);
};
document.body.appendChild(script);
}

22
templates/base.j2 Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="{{ language }}">
{% include "components/head.j2" %}
<body>
{% include "components/header.j2" %}
<main>
{% if home %}
{% include "components/index.j2" %}
{% elif section %}
{% include "components/section.j2" %}
{% else %}
{% include "components/single.j2" %}
{% endif %}
</main>
{% include "components/sidebar.j2" %}
{% include "components/footer.j2" %}
{% include "components/script.j2" %}
{% include "components/schema.j2" %}
</body>
</html>

View File

@ -0,0 +1,19 @@
{% if home %}
<p>&#127760;
{% for key, value in config.languages.items() %}
{% if key != language %}
<a href="/{{ key }}">{{ value.language_name }}</a>
{% endif %}
{% endfor %}
</p>
{% else %}
<p>
&#127760;
{% for key, value in config.languages.items() %}
{% if key != language %}
<a href="/{{ key + url if url else key + "/" + section }}">{{
value.language_name }}</a>
{% endif %}
{% endfor %}
</p>
{% endif %}

View File

@ -0,0 +1,9 @@
<small>
<time datetime={{ post.date }}>
<b>&#128197; {{ translate('published', language) | capitalize }}</b>: {{ post.date.strftime('%Y-%m-%d') }}
</time>
<br />
<b>&#129496; {{ translate('by', language) | capitalize }}</b>:
<a href="/{{ language }}/about-author">{{ config['languages'][language]['author'] }}</a>
</small>

View File

@ -0,0 +1,3 @@
<footer>
<b>{{ translate('copyright_message', language) }}</b>
</footer>

View File

@ -0,0 +1,18 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% set title = config.languages[language].title %}
{% set description = config.languages[language].description %}
{% if section %}
{% set title = (translate(section, language) | capitalize) + " | " + title %}
{% set description = title %}
{% elif not home %}
{% set title = post.title + " | " + title %}
{% set description = post.description %}
{% endif %}
<title>{{ title }}</title>
<meta name="title" content="{{ title }}" />
<meta name="description" content="{{ description }}" />
<link href="/css/style.css" rel="stylesheet">
{% if config.custom_css %}<link href="/css/{{ config.custom_css }}" rel="stylesheet">{% endif %}
</head>

View File

@ -0,0 +1,7 @@
<header>
<a href="/{{ language }}">
<img src="/logo.svg" alt="{{ config['languages'][language]['title'] }}" />
<h3>{{ config['languages'][language]['description'] }}</h3>
</a>
{% include "components/all_languages.j2" %}
</header>

View File

@ -0,0 +1,11 @@
{% if post.image %}
<p>
{% if home or section %}
<a href="/{{ language }}{{ url }}" rel="permalink" title="{{ image_title }}">
<img src="{{ post.image }}" alt="{{ image_title }}" class="home-image" />
</a>
{% else %}
<img src="{{ post.image }}" alt="{{ image_title }}" class="post-image" />
{% endif %}
</p>
{% endif %}

View File

@ -0,0 +1,5 @@
{% for section, urls in posts[language].items() %}
{% for url, post in urls.items() %}
{% include "components/post_summary.j2" %}
{% endfor %}
{% endfor %}

View File

@ -0,0 +1,12 @@
<article>
<h2>
<a class="index-title" href="/{{ language }}{{ url }}" rel="permalink" title="{{ post.title }}">{{ post.title }}</a>
</h2>
{% include "components/author_and_date.j2" %}
{% include "components/image.j2" %}
{{ post.description }}
<br />
<a href="/{{ language }}{{ url }}">{{ translate('readmore', language) | capitalize }}...</a>
</article>

View File

@ -0,0 +1,44 @@
{% if home %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "{{ title }}",
"url": "{{ url }}",
"description": "{{ description }}",
"thumbnailUrl": "{{ logo_url }}",
}
</script>
{% else %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": {{ config.schema.type }},
{# "articleSection": {{ translate(section, language) }}, #}
{% if config.schema.type == 'TechArticle' %}
"proficiencyLevel": "Beginner",
{% endif %}
"name": {{ title }},
"headline": {{ title }},
"inLanguage": {{ language }},
"wordCount": {{ wordcount }},
"description": {{ description }},
"datePublished": {{ date_published }},
"dateModified": {{ date_modified }},
"author": {
"@type": "Person",
"name": {{ config.languages[language].author }},
"url": {{ config.baseURL + "/" + language + "/about-author" }}
},
"publisher": {
"@type": "Organization",
"name": "{{ config.languages[language].title }}",
"url": {{ config.baseUrl }},
"logo": {
"@type": "ImageObject",
"url": {{ logo_url }}
}
}
}
</script>
{% endif %}

View File

@ -0,0 +1,3 @@
{% for include in includes %}
<script defer src="/js/{{ include }}"></script>
{% endfor %}

View File

@ -0,0 +1,3 @@
{% for url, post in posts[language][section].items() %}
{% include "components/post_summary.j2" %}
{% endfor %}

View File

@ -0,0 +1,9 @@
<div class="sidebar">
<section>
{% for section, urls in posts[language].items() %}
<p>
<a href="/{{ language}}/{{ section }}">{{ translate(section, language) }} ({{ urls | length }})</a>
</p>
{% endfor %}
</section>
</div>

View File

@ -0,0 +1,7 @@
<article>
<h1>{{ post.title }}</h1>
{% include "components/author_and_date.j2" %}
{% include "components/image.j2" %}
{{ post.content }}
</article>

View File

@ -0,0 +1,20 @@
<div class="social-icons">
{{ if .Site.Params.youtube }}
<a href="https://youtube.com/{{ .Site.Params.Youtube }}">
<img src="data:image/svg+xml;base64,{{ readFile "/static/images/youtube.svg" | base64Encode }}"
alt="{{ .Site.Title }}" width="100" />
</a>
{{ end }}
{{ if .Site.Params.github }}
<a href="https://github.com/{{ .Site.Params.Github }}">
<img src="data:image/svg+xml;base64,{{ readFile "/static/images/github.svg" | base64Encode }}"
alt="{{ .Site.Title }}" width="100" />
</a>
{{ end }}
{{ if .Site.Params.telegram }}
<a href="https://t.me/{{ .Site.Params.Telegram }}">
<img src="data:image/svg+xml;base64,{{ readFile "/static/images/telegram.svg" | base64Encode }}"
alt="{{ .Site.Title }}" width="100" />
</a>
{{ end }}
</div>

5
templates/shortcodes.j2 Normal file
View File

@ -0,0 +1,5 @@
{% macro audio(src) %}
<audio controls preload="auto">
<source src="{{ src }}">
</audio>
{% endmacro %}