From e9c35a9eff9e0881df7d6a6e8d17b70ac37ad0fe Mon Sep 17 00:00:00 2001 From: Jefferson Julio Date: Sun, 30 May 2021 20:06:28 -0300 Subject: Better modularization --- pages/article.sh | 21 +++------------------ pages/contato.sh | 23 +++++++++++++++++++++++ pages/home.sh | 29 +++++++++++++++-------------- 3 files changed, 41 insertions(+), 32 deletions(-) mode change 100644 => 100755 pages/contato.sh (limited to 'pages') diff --git a/pages/article.sh b/pages/article.sh index 9832a76..b50d922 100755 --- a/pages/article.sh +++ b/pages/article.sh @@ -1,26 +1,11 @@ #!/bin/bash -ARTICLE_TITLE=$(basename "$ARTICLE_FILE") - -# Pick all file content -ARTICLE_FILE_CONTENT=$(cat "$ARTICLE_FILE") - -# The first 3 lines of the file are metadata information -ARTICLE_METADATA=$(echo "$ARTICLE_FILE_CONTENT" | head -n 3) - -# Skip file metadata, first 3 lines -ARTICLE_CONTENT=$(echo "$ARTICLE_FILE_CONTENT" | tail -n +3) - -# Tags are placed on the first line of the file, delimited by commas -IFS=',' read -ra ARTICLE_TAGS <<< "$(echo "$ARTICLE_METADATA" | head -n 1)" - -ARTICLE_TIME=$(stat --format="Criado em: %w
Última atualização: %z" "$ARTICLE_FILE") -ARTICLE_BYTES=$(stat --format="%o bytes" "$ARTICLE_FILE") +source $SCRIPT_DIR/utils/parse-article.sh if [ $? -gt 0 ]; then STATUS=404 cat <cat: $ARTICLE_FILE: Arquivo ou diretório inexistente

+

404: $ARTICLE_FILE: Arquivo ou diretório inexistente

ERR exit 0 fi @@ -29,7 +14,7 @@ cat <
-

stat -c "%o %w %z" $ARTICLE_FILE

+

$ stat -c "%s %w %z" \\
> $ARTICLE_FILE

$ARTICLE_BYTES

diff --git a/pages/contato.sh b/pages/contato.sh old mode 100644 new mode 100755 index 74d1ad4..b54a64e --- a/pages/contato.sh +++ b/pages/contato.sh @@ -1,4 +1,5 @@ #!/bin/bash + cat < @media screen and (max-width: 600px) { @@ -9,5 +10,27 @@ cat <
+
+

Formas de contato

+ +

+ Primeiramente, muito obrigado pelo interesse em me contatar! Você pode ver abaixo minhas + informações de contato, pode me chamar a qualquer hora, mas só respondo em horário + comercial. Se for algo urgente, escreva "URGENTE" sem aspas no título da mensagem + que tentarei fazer de tudo para atendê-lo o quanto antes. +

+
+ +
+
+ Email: snhr.jj@gmail.com
+ Linkedin: + + https://www.linkedin.com/in/jefferson-j%C3%BAlio-56a30b149 + +
+
PAGE + +# Celular e Whatsapp: +55 (81) 97326-9793
diff --git a/pages/home.sh b/pages/home.sh index ebb399d..c9a9966 100755 --- a/pages/home.sh +++ b/pages/home.sh @@ -1,25 +1,26 @@ #!/bin/bash -print-all-articles () { - for i in $(find ./pages/articles -type f -name '*.txt'); do - ARTICLE_CONTENT=$(tail -n +3 $i) - cat < -
-
stat -c "%w %z" $i
- -
- -

$(echo "$ARTICLE_CONTENT" | head -c 120)...

- - Ler artigo completo +welcome () { + cat < +
+

Bem-vindo ao meu blog :3

+

Aqui mostro o meu trabalho e escrevo sobre programação.

+
-POST +WELCOME +} + +print-all-articles () { + # Find all articles and sort by date of creation + for i in $(find $ARTICLES_PATH -type f -name '*.txt' -printf "%T@ %p\n" | sort -rn | cut -b 23-); do + ARTICLE_FILE="${i/* /}" source $SCRIPT_DIR/components/post-preview.sh done } cat < + $(welcome) $(print-all-articles)
PAGE -- cgit v1.2.3