commit 15ac0bf416d377f11195c27e9f71717469770800 parent 15ebbf854f0a9df96c409cb5183b63687dc5a0ba Author: zakaria <58356365+e-zk@users.noreply.github.com> Date: Tue, 2 Mar 2021 16:22:07 +1000 Update index.sh Diffstat:
M | index.sh | | | 66 | +++++++++++++++++++++++++++++++++++------------------------------- |
1 file changed, 35 insertions(+), 31 deletions(-)
diff --git a/index.sh b/index.sh @@ -14,44 +14,48 @@ get_posts() { done | tail -r } -# START html -printf '<!DOCTYPE html>\n' -printf '<html lang="en">\n' +gen_index() { + # START html + printf '<!DOCTYPE html>\n' + printf '<html lang="en">\n' -# generate the head -gen_head "$post_file" "${site_name}" + # generate the head + gen_head "$post_file" "${site_name}" -# START body -printf '<body>\n' + # START body + printf '<body>\n' -# generate navigation -gen_nav + # generate navigation + gen_nav -printf '<main>\n' + printf '<main>\n' -# print stuff -cat "${html_dir}/posts.html" + # print stuff + cat "${html_dir}/posts.html" -# list posts -printf '<ul class="postslist">\n' -for post in $(get_posts); do - log "adding "$post" to index..." + # list posts + printf '<ul class="postslist">\n' + for post in $(get_posts); do + log "adding "$post" to index..." - post_md="${post%%.*}.md" - post_url="$(basename "$post")" - date_parsed="$(parse_fname "$post_url")" - post_title="$(md_title "$post_md" | md_to_txt)" - post_date="${date_parsed%%:*}" + post_md="${post%%.*}.md" + post_url="$(basename "$post")" + date_parsed="$(parse_fname "$post_url")" + post_title="$(md_title "$post_md" | md_to_txt)" + post_date="${date_parsed%%:*}" - printf '<li>\n' - printf '<a href="%s"><span class="right postdate">%s</span>%s</a>\n' "$post_url" "$post_date" "$post_title" - printf '</li>\n' -done -printf '</ul>\n' -printf '</main>\n' + printf '<li>\n' + printf '<a href="%s"><span class="right postdate">%s</span>%s</a>\n' "$post_url" "$post_date" "$post_title" + printf '</li>\n' + done + printf '</ul>\n' + printf '</main>\n' -# END body -printf '</body>\n' + # END body + printf '</body>\n' -# END html -printf '</html>\n' + # END html + printf '</html>\n' +} + +gen_index > "$posts_index"