1
0
Fork 0

2024-08-31

This commit is contained in:
Gennadiy 2024-09-01 08:46:26 +03:00
parent 1dec4af1c6
commit b8df571cd7
8 changed files with 10 additions and 12 deletions

View file

@ -44,11 +44,11 @@ redirection file to the root of the site for all subdirectories, if they don't c
file. The script is intended for this purpose. file. The script is intended for this purpose.
```shell ```shell
echo "Optimizing gathered content." # optimizing gathered content
cd _site || exit cd _site || exit
cp -r assets/* . cp -r assets/* .
rm -r assets rm -r assets
echo "Optimizing a number of tags." # optimizing a number of tags
function optimize_html { function optimize_html {
echo "Optimize: $1" echo "Optimize: $1"
sed -i 's| class="language-plaintext highlighter-rouge"||g' "$1" sed -i 's| class="language-plaintext highlighter-rouge"||g' "$1"
@ -63,9 +63,9 @@ function optimize_html {
sed -i -r 's|<img(.+) />|<img\1>|g' "$1" sed -i -r 's|<img(.+) />|<img\1>|g' "$1"
} }
export -f optimize_html export -f optimize_html
echo "Launching parallel processing of gathered pages and optimizing a number of tags." # launching parallel processing of gathered pages and optimizing a number of tags
find . -type f -name "*.html" -print0 | xargs -I{} -n1 -0 -P0 bash -c 'optimize_html "{}"' find . -type f -name "*.html" -print0 | xargs -I{} -n1 -0 -P0 bash -c 'optimize_html "{}"'
echo "Transition page to the root of the site for directories without a main page." # transition page to the root of the site for directories without a main page
find . -type d -print0 | xargs -I{} -n1 -0 -P0 cp -n return.html {}/index.html find . -type d -print0 | xargs -I{} -n1 -0 -P0 cp -n return.html {}/index.html
rm -r return.html rm -r return.html
``` ```

View file

@ -43,11 +43,11 @@ sudo gem install --local older-tomato-theme-1.0.1.gem
сайта для всех подкаталогов, если в них отсутствует файл `index.html`. Скрипт предназначен для этой цели. сайта для всех подкаталогов, если в них отсутствует файл `index.html`. Скрипт предназначен для этой цели.
```shell ```shell
echo "Оптимизация собранного контента." # оптимизация собранного контента
cd _site || exit cd _site || exit
cp -r assets/* . cp -r assets/* .
rm -r assets rm -r assets
echo "Оптимизация ряда тегов." # оптимизация ряда тегов
function optimize_html { function optimize_html {
echo "Оптимизация: $1" echo "Оптимизация: $1"
sed -i 's| class="language-plaintext highlighter-rouge"||g' "$1" sed -i 's| class="language-plaintext highlighter-rouge"||g' "$1"
@ -62,9 +62,9 @@ function optimize_html {
sed -i -r 's|<img(.+) />|<img\1>|g' "$1" sed -i -r 's|<img(.+) />|<img\1>|g' "$1"
} }
export -f optimize_html export -f optimize_html
echo "Запуск параллельной обработки собранных страниц и оптимизации ряда тегов." # запуск параллельной обработки собранных страниц и оптимизации ряда тегов
find . -type f -name "*.html" -print0 | xargs -I{} -n1 -0 -P0 bash -c 'optimize_html "{}"' find . -type f -name "*.html" -print0 | xargs -I{} -n1 -0 -P0 bash -c 'optimize_html "{}"'
echo "Страница перехода в корень сайта для каталогов без заглавной страницы." # страница перехода в корень сайта для каталогов без заглавной страницы
find . -type d -print0 | xargs -I{} -n1 -0 -P0 cp -n return.html {}/index.html find . -type d -print0 | xargs -I{} -n1 -0 -P0 cp -n return.html {}/index.html
rm -r return.html rm -r return.html
``` ```

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" <svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 17 17" width="64" height="64">
width="64" height="64" viewBox="-1 -1 18 18">
<g stroke-width="0.1"> <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="#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"/> <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" <svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 1.5 27 27" width="30" height="30">
width="30" height="30" viewBox="0 0 30 30">
<g fill="#222" stroke="#222" stroke-width="0.1"> <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"/> <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> </g>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB