1
0
Fork 0

Compare commits

...

10 commits

Author SHA1 Message Date
ef52324aa4 2024-12-29 2024-12-29 10:39:46 +03:00
2dc300f8f2 2024-10-31 2024-10-31 21:39:02 +03:00
9e0d4a2d4d 2024-09-30 2024-10-01 18:02:30 +03:00
b8df571cd7 2024-08-31 2024-09-01 08:46:26 +03:00
1dec4af1c6 2024-07-31 2024-07-31 21:14:39 +03:00
8d7c5560c9 2024-04-30 2024-05-02 20:37:23 +03:00
d89bb84a1f 2024-03-31 2024-03-31 02:20:49 +03:00
617d37844f 2024-02-29 2024-02-29 22:58:52 +03:00
a300bcc8a6 2023-12-30 2023-12-30 23:36:43 +03:00
76c9eec00e 2023-11-30 2023-12-17 09:49:15 +03:00
15 changed files with 113 additions and 53 deletions

View file

@ -42,7 +42,8 @@
│ │ │ └─ <a href='jekyll_theme/assets/resources/fonts/Roboto/Roboto-Regular.woff'>Roboto-Regular.woff</a>
│ │ ├─ <a href='jekyll_theme/assets/404.html'>404.html</a>
│ │ ├─ <a href='jekyll_theme/assets/favicon.ico'>favicon.ico</a>
│ │ └─ <a href='jekyll_theme/assets/pagesmap.xml'>pagesmap.xml</a>
│ │ ├─ <a href='jekyll_theme/assets/pagesmap.xml'>pagesmap.xml</a>
│ │ └─ <a href='jekyll_theme/assets/return.html'>return.html</a>
│ ├─ <a href='jekyll_theme/Gemfile'>Gemfile</a>
│ ├─ <a href='jekyll_theme/install.sh'>install.sh</a>
│ └─ <a href='jekyll_theme/older-tomato-theme.gemspec'>older-tomato-theme.gemspec</a>

View file

@ -1,4 +1,4 @@
© Головин Г.Г., 2021-2023
© Головин Г.Г., 2021-2024
Опубликовано под [Открытой лицензией 1.1](OPEN_LICENSE.txt)
@ -8,7 +8,7 @@
---
© Golovin G.G., translation from Russian, 2021-2023
© Golovin G.G., translation from Russian, 2021-2024
Published under the [Open License 1.1](OPEN_LICENSE.txt)

View file

@ -7,7 +7,7 @@ appearance resembles the default design theme on GitHub Pages. Both themes suppl
each other and are similar to each other, commonalities and differences between them
are marked in the list of features.
- [Color tomato](https://hub.mos.ru/golovin/color-tomato-theme/blob/master/README.en.md) — color selection during the build.
- [Color tomato](https://git.org.ru/golovin/color-tomato-theme/src/branch/master/README.en.md) — color selection during the build.
- Older tomato — lightweight decoration theme.
### Features
@ -18,6 +18,7 @@ are marked in the list of features.
- [x] Switch between two languages and two tomato themes.
- [x] Map of site pages with their translations in XML format.
- [x] Simple 404 page for non-existing URLs.
- [x] Redirection to site root from folders, without `index.html`.
- [x] Fonts: Roboto for text and JBMono for code blocks.
- [x] Tomatoes: PNG, JPG 120x120, SVG 64x64, ICO 32x32.
- [ ] Color selection during the build, green is the default color.
@ -37,27 +38,33 @@ sudo gem install --local older-tomato-theme-1.0.1.gem
The site can be built using the `jekyll build` command. After that, we get the `_site` folder with the
generated pages and the `assets` subfolder from the theme. We move the contents of this subfolder back
to the `_site` folder — we get shorter links, that are used in the theme. After that we bypass HTML
pages and optimize a number of tags also for shortness and for correctness. The script is intended
for this purpose.
to the `_site` folder — we get shorter links, that are used in the theme. After that we bypass HTML pages
and optimize a set of tags also for shortness and for correctness. Additionally, we copy from theme the
redirection file to the root of the site for all subdirectories, if they don't contain the `index.html`
file. The script is intended for this purpose.
```shell
echo "Optimization of gathered content."
# optimizing gathered content
cd _site || exit
cp -r assets/* .
rm -r assets
find . -type f -name '*.html' | sort -r | while read -r file; do
sed -i 's/ class="language-plaintext highlighter-rouge"//g' "$file"
sed -i 's/ class="language-java highlighter-rouge"//g' "$file"
sed -i 's/ class="language-html highlighter-rouge"//g' "$file"
sed -i 's/ class="language-js highlighter-rouge"//g' "$file"
sed -i 's/ class="language-bash highlighter-rouge"//g' "$file"
sed -i 's/<div><div class="highlight"><pre class="highlight">/<div class="highlight"><pre class="highlight">/g' "$file"
sed -i 's/<\/code><\/pre><\/div><\/div>/<\/code><\/pre><\/div>/g' "$file"
sed -i 's/<hr \/>/<hr>/g' "$file"
sed -i -r 's/<input(.+) \/>/<input\1>/g' "$file"
sed -i -r 's/<img(.+) \/>/<img\1>/g' "$file"
done
# patterns for optimizing a set of tags
expr+=('s| class="language-plaintext highlighter-rouge"||g')
expr+=('s| class="language-java highlighter-rouge"||g')
expr+=('s| class="language-html highlighter-rouge"||g')
expr+=('s| class="language-js highlighter-rouge"||g')
expr+=('s| class="language-bash highlighter-rouge"||g')
expr+=('s|<div><div class="highlight">|<div class="highlight">|g')
expr+=('s|</pre></div></div>|</pre></div>|g')
expr+=('s|<hr />|<hr>|g')
expr+=('s|<input(.+) />|<input\1>|g')
expr+=('s|<img(.+) />|<img\1>|g')
# launching parallel processing of gathered pages and optimizing a set of tags
find . -type f -name "*.html" -printf '%p\0' | xargs -I{} -n1 -0 -P0 bash -c \
"echo 'Optimize: {}' && sed -i -E $(printf " -e '%s'" "${expr[@]}") '{}'"
# transition to the site root for directories without a main page
find . -type d -exec cp -n return.html {}/index.html \;
rm -r return.html
```
### Directory structure
@ -105,9 +112,9 @@ url: "https://pomodoro.example.ru"
# subfolder of this build for relative URLs
baseurl: ""
# weblink in the top-left of the main pages
homepage_url: "https://hub.mos.ru/tolstoy.ln"
homepage_url: "https://git.org.ru/tolstoy.ln"
# representation of the weblink
homepage_name: "HUB.MOS.RU"
homepage_name: "GIT.ORG.RU"
# subfolder of the alternative build,
# can be omitted, if not used
color_tomato_baseurl: "/color"
@ -122,6 +129,10 @@ author: "Толстой Л.Н."
author_translated: "Tolstoy L.N."
# addition to footer caption for translated pages
translation_caption: "translation from Russian"
# counter numbers for pages,
# can be omitted, if not used
live_internet: "abcdefghij"
yandex_metrika: "1234567890"
# design theme for the build
theme: older-tomato-theme
# layout for the build
@ -179,4 +190,4 @@ translation_caption: "translation from Russian"
---
© Golovin G.G., Code with comments, translation from Russian, 2021-2023
© Golovin G.G., Code with comments, translation from Russian, 2021-2024

View file

@ -7,7 +7,7 @@
дополняют друг друга и похожи друг на друга, общие черты и различия между ними отмечены
в списке свойств.
- [Цветной помидор](https://hub.mos.ru/golovin/color-tomato-theme/blob/master/README.md) — выбор цвета во время сборки.
- [Цветной помидор](https://git.org.ru/golovin/color-tomato-theme/src/branch/master/README.md) — выбор цвета во время сборки.
- Старый помидор — легковесная тема оформления.
### Свойства
@ -18,6 +18,7 @@
- [x] Переключение между двумя языками и помидорными темами.
- [x] Карта страниц сайта с их переводами в формате XML.
- [x] Простая страница 404 для несуществующих URL-адресов.
- [x] Перенаправление в корень сайта из папок, где нет `index.html`.
- [x] Шрифты: Roboto для текста и JBMono для блоков кода.
- [x] Помидоры: PNG, JPG 120x120, SVG 64x64, ICO 32x32.
- [ ] Выбор цвета во время сборки, зелёный цвет по умолчанию.
@ -37,26 +38,32 @@ sudo gem install --local older-tomato-theme-1.0.1.gem
Сборка сайта выполняется командой `jekyll build`. После этого мы получаем папку `_site` с собранными
страницами и подпапку `assets` из темы. Перемещаем содержимое этой подпапки обратно в папку `_site`
получаем короткие ссылки, которые используются в теме. После этого обходим страницы HTML и оптимизируем
ряд тегов также для краткости и для корректности. Скрипт предназначен для этой цели.
получаем короткие ссылки, которые используются в теме. После этого обходим страницы HTML и оптимизируем ряд
тегов также для краткости и для корректности. Дополнительно копируем из темы файл перенаправления в корень
сайта для всех подкаталогов, если в них отсутствует файл `index.html`. Скрипт предназначен для этой цели.
```shell
echo "Оптимизация собранного контента."
# оптимизация собранного контента
cd _site || exit
cp -r assets/* .
rm -r assets
find . -type f -name '*.html' | sort -r | while read -r file; do
sed -i 's/ class="language-plaintext highlighter-rouge"//g' "$file"
sed -i 's/ class="language-java highlighter-rouge"//g' "$file"
sed -i 's/ class="language-html highlighter-rouge"//g' "$file"
sed -i 's/ class="language-js highlighter-rouge"//g' "$file"
sed -i 's/ class="language-bash highlighter-rouge"//g' "$file"
sed -i 's/<div><div class="highlight"><pre class="highlight">/<div class="highlight"><pre class="highlight">/g' "$file"
sed -i 's/<\/code><\/pre><\/div><\/div>/<\/code><\/pre><\/div>/g' "$file"
sed -i 's/<hr \/>/<hr>/g' "$file"
sed -i -r 's/<input(.+) \/>/<input\1>/g' "$file"
sed -i -r 's/<img(.+) \/>/<img\1>/g' "$file"
done
# шаблоны для оптимизации ряда тегов
expr+=('s| class="language-plaintext highlighter-rouge"||g')
expr+=('s| class="language-java highlighter-rouge"||g')
expr+=('s| class="language-html highlighter-rouge"||g')
expr+=('s| class="language-js highlighter-rouge"||g')
expr+=('s| class="language-bash highlighter-rouge"||g')
expr+=('s|<div><div class="highlight">|<div class="highlight">|g')
expr+=('s|</pre></div></div>|</pre></div>|g')
expr+=('s|<hr />|<hr>|g')
expr+=('s|<input(.+) />|<input\1>|g')
expr+=('s|<img(.+) />|<img\1>|g')
# запуск параллельной обработки собранных страниц и оптимизация ряда тегов
find . -type f -name "*.html" -printf '%p\0' | xargs -I{} -n1 -0 -P0 bash -c \
"echo 'Оптимизация: {}' && sed -i -E $(printf " -e '%s'" "${expr[@]}") '{}'"
# переход в корень сайта для каталогов без заглавной страницы
find . -type d -exec cp -n return.html {}/index.html \;
rm -r return.html
```
### Структура каталогов
@ -101,12 +108,12 @@ name: "Код с комментариями"
name_translated: "Code with comments"
# URL адрес сайта, включая протокол
url: "https://pomodoro.example.ru"
# подпапка этой сборки для относительных URLs
# подпапка этой сборки для относительных URL-ов
baseurl: ""
# ссылка в верхнем левом углу заглавных страниц
homepage_url: "https://hub.mos.ru/tolstoy.ln"
homepage_url: "https://git.org.ru/tolstoy.ln"
# представление ссылки
homepage_name: "HUB.MOS.RU"
homepage_name: "GIT.ORG.RU"
# подпапка альтернативной сборки, можно
# не указывать, если не используется
color_tomato_baseurl: "/color"
@ -121,6 +128,10 @@ author: "Толстой Л.Н."
author_translated: "Tolstoy L.N."
# дополнение к подписи в футере для переведённых страниц
translation_caption: "translation from Russian"
# номера счётчиков для страниц, можно
# не указывать, если не используются
live_internet: "abcdefghij"
yandex_metrika: "1234567890"
# тема оформления для сборки
theme: older-tomato-theme
# макет для сборки
@ -178,4 +189,4 @@ translation_caption: "translation from Russian"
---
© Головин Г.Г., Код с комментариями, 2021-2023
© Головин Г.Г., Код с комментариями, 2021-2024

View file

@ -1,2 +1,4 @@
<!-- begin counters_body template -->
<!-- end counters_body template -->
{% if site.yandex_metrika -%}
<noscript><div><img src="https://mc.yandex.ru/watch/{{- site.yandex_metrika -}}" style="position:absolute; left:-9999px;" alt=""></div></noscript>
<!-- end yandex_metrika counter -->
{% endif -%}

View file

@ -1,2 +1,19 @@
<!-- begin counters_head template -->
<!-- end counters_head template -->
{% if site.live_internet -%}
<!-- begin live_internet counter -->
<script>
new Image().src="https://counter.yadro.ru/hit;{{- site.live_internet -}}?r"+encodeURIComponent
(document.referrer)+((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+
(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+";u"+encodeURIComponent(document.URL)
+";h"+encodeURIComponent(document.title.substring(0,150))+";"+Math.random();
</script>
<!-- end live_internet counter -->
{% endif -%}
{% if site.yandex_metrika -%}
<!-- begin yandex_metrika counter -->
<script>
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();for(var j=0;j<
document.scripts.length;j++){if(document.scripts[j].src===r){return;}}k=e.createElement(t),a=e.getElementsByTagName(t)
[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})(window,document,"script","https://mc.yandex.ru/metrika/tag.js",
"ym");ym({{- site.yandex_metrika -}},"init",{clickmap:true,trackLinks:true,accurateTrackBounce:true,webvisor:true});
</script>
{% endif -%}

View file

@ -15,6 +15,6 @@ pre, code { font-family: JBMono, monospace; font-variant: none; }
/* number */
.mi, .mf { color: #3866ee; }
/* string */
.s, .s1, .s2, .dl { color: #080; }
.s, .s1, .s2, .se, .dl { color: #080; }
/* comment */
.c, .c1, .cm { color: #9e9e9e; }

View file

@ -28,6 +28,7 @@ p a:hover {
h2 a, h3 a {
display: none;
user-select: none;
}
h2:hover a, h3:hover a {
@ -36,7 +37,7 @@ h2:hover a, h3:hover a {
}
.toolbar b {
font-size: 22px;
font-size: 24px;
font-weight: 500;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

@ -1,5 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="64" height="64" viewBox="-1 -1 18 18">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 17 17" width="64" height="64">
<g stroke-width="0.1">
<path fill="#222" stroke="#222" d="M8.5,5C8.3,5,8.1,4.9,8,4.7c-0.1-0.3-0.9-3,0.1-4.4C8.3,0,8.6-0.1,8.8,0.1C9,0.3,9.1,0.6,8.9,0.8 C8.3,1.6,8.8,3.7,9,4.3C9.1,4.6,8.9,4.9,8.7,5C8.6,5,8.6,5,8.5,5z"/>
<path fill="#fff" stroke="#fff" d="M8,15.5c-4.1,0-7.5-3.1-7.5-6.9C0.5,4.4,3,2.2,8,2.2s7.5,2.1,7.5,6.4C15.5,12.4,12.1,15.5,8,15.5z"/>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1,5 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="30" height="30" viewBox="0 0 30 30">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 1.5 27 27" width="30" height="30">
<g fill="#222" stroke="#222" stroke-width="0.1">
<path d="M 8 3 A 1.0001 1.0001 0 0 0 7 4 L 7 11 L 9 11 L 9 5 L 21 5 L 21 11 L 23 11 L 23 4 A 1.0001 1.0001 0 0 0 22 3 L 8 3 z M 6 13 C 4.895 13 4 13.895 4 15 L 3 15 A 1.0001 1.0001 0 1 0 3 17 L 4 17 L 4 24 C 4 25.657 5.343 27 7 27 L 23 27 C 24.657 27 26 25.657 26 24 L 26 17 L 27 17 A 1.0001 1.0001 0 1 0 27 15 L 26 15 C 26 13.895 25.105 13 24 13 L 17 13 C 16.448 13 16 13.448 16 14 C 16 14.552 16.448 15 17 15 L 19 15 C 19.552 15 20 15.448 20 16 C 20 16.552 19.552 17 19 17 L 11 17 C 10.448 17 10 16.552 10 16 C 10 15.448 10.448 15 11 15 L 13 15 C 13.552 15 14 14.552 14 14 C 14 13.448 13.552 13 13 13 L 6 13 z M 9 19 C 9.552 19 10 19.448 10 20 C 10 20.552 9.552 21 9 21 C 8.448 21 8 20.552 8 20 C 8 19.448 8.448 19 9 19 z M 13 19 C 13.552 19 14 19.448 14 20 C 14 20.552 13.552 21 13 21 C 12.448 21 12 20.552 12 20 C 12 19.448 12.448 19 13 19 z M 17 19 C 17.552 19 18 19.448 18 20 C 18 20.552 17.552 21 17 21 C 16.448 21 16 20.552 16 20 C 16 19.448 16.448 19 17 19 z M 21 19 C 21.552 19 22 19.448 22 20 C 22 20.552 21.552 21 21 21 C 20.448 21 20 20.552 20 20 C 20 19.448 20.448 19 21 19 z M 11 22 C 11.552 22 12 22.448 12 23 C 12 23.552 11.552 24 11 24 C 10.448 24 10 23.552 10 23 C 10 22.448 10.448 22 11 22 z M 15 22 C 15.552 22 16 22.448 16 23 C 16 23.552 15.552 24 15 24 C 14.448 24 14 23.552 14 23 C 14 22.448 14.448 22 15 22 z M 19 22 C 19.552 22 20 22.448 20 23 C 20 23.552 19.552 24 19 24 C 18.448 24 18 23.552 18 23 C 18 22.448 18.448 22 19 22 z"/>
</g>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,19 @@
---
layout: null
permalink: return.html
---
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Перенаправление&hellip;</title>
<link rel="canonical" href="{{ site.baseurl | append: '/' }}">
<script>location="{{ site.baseurl | append: '/' }}"</script>
<meta http-equiv="refresh" content="0; url={{ site.baseurl | append: '/' }}">
</head>
<body>
<h1>Перенаправление&hellip;</h1>
<a href="{{ site.baseurl | append: '/' }}">Перенаправление на заглавную страницу сайта&hellip;</a>
</body>
</html>