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 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
(limited to 'pages/article.sh')
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 <