diff options
author | Jefferson Julio <[email protected]> | 2021-05-30 22:53:32 -0300 |
---|---|---|
committer | Jefferson Julio <[email protected]> | 2021-05-30 22:53:32 -0300 |
commit | 381bff129b70471e86e99a2d6b6a7e090f13287e (patch) | |
tree | 35d383b4ec622efd8fbbd49a72c44a5561a04f92 /pages/home.sh | |
parent | e9c35a9eff9e0881df7d6a6e8d17b70ac37ad0fe (diff) | |
download | blog.sh-381bff129b70471e86e99a2d6b6a7e090f13287e.tar.bz2 blog.sh-381bff129b70471e86e99a2d6b6a7e090f13287e.zip |
Better article parsing, support for article code parsing (add line numbers to code blocks)
Diffstat (limited to 'pages/home.sh')
-rwxr-xr-x | pages/home.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pages/home.sh b/pages/home.sh index c9a9966..02adf53 100755 --- a/pages/home.sh +++ b/pages/home.sh @@ -13,8 +13,19 @@ 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 + IFS=';' read -ra ARTICLE_LIST <<< "$( + find $ARTICLES_PATH \ + -type f \ + -name '*.txt' \ + -printf "%T@ %p\n" | + sort -rn | + cut -b 23- | + sed 's/^ //g' | + tr '\n' ';' + )" + + for i in "${ARTICLE_LIST[@]}"; do + ARTICLE_FILE="$i" source $SCRIPT_DIR/components/post-preview.sh done } |