From cade848b78d7f06b69a195f5a543b23c25eedd14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tel=C3=A9rico=20Jones?=
Date: Sat, 29 May 2021 21:09:08 -0300
Subject: blog.sh project start
---
pages/article.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100755 pages/article.sh
(limited to 'pages/article.sh')
diff --git a/pages/article.sh b/pages/article.sh
new file mode 100755
index 0000000..9832a76
--- /dev/null
+++ b/pages/article.sh
@@ -0,0 +1,52 @@
+#!/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")
+
+if [ $? -gt 0 ]; then
+ STATUS=404
+ cat <cat: $ARTICLE_FILE: Arquivo ou diretório inexistente
+ERR
+ exit 0
+fi
+
+cat <
+
+
+
+
+
+ ${ARTICLE_CONTENT}
+
+
+
+
+ARTICLE
--
cgit v1.2.3