aboutsummaryrefslogtreecommitdiff
path: root/generate.sh
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-01-25 17:44:57 +0000
committerAkshay <[email protected]>2020-01-25 17:44:57 +0000
commitbfad52fec2a77888fc149a0ed4249af3509aef4a (patch)
treea1938052a50409323c478b12d1bd38ce2c13ca00 /generate.sh
parent5924e263893ac8c47a22a78c88b46c585fc9e82b (diff)
include commit hashes
Diffstat (limited to 'generate.sh')
-rwxr-xr-xgenerate.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/generate.sh b/generate.sh
index ee08a4b..a95fb06 100755
--- a/generate.sh
+++ b/generate.sh
@@ -10,11 +10,15 @@ title_wrapper() {
10link_wrapper() { 10link_wrapper() {
11 # 1 - id 11 # 1 - id
12 # 2 - title 12 # 2 - title
13 # 2 - date 13 # 3 - date
14 # 4 - commit hash
14 echo -ne " 15 echo -ne "
15 <div class=\"post\"> 16 <div class=\"post\">
16 <div class=\"date\">$3</div> 17 <div class=\"date\">
17 <a href=\"/posts/$1.html\" class=\"post-link\"> 18 $3
19 <span class=\"commit-hash\">$4</span>
20 </div>
21 <a href=\"/posts/$1\" class=\"post-link\">
18 <span class=\"post-link\">$2</span> 22 <span class=\"post-link\">$2</span>
19 </a> 23 </a>
20 </div> 24 </div>
@@ -65,12 +69,14 @@ for f in $posts; do
65 commit="$(git log -n1 --oneline "$file" | sed -e 's/\s.*$//g')" 69 commit="$(git log -n1 --oneline "$file" | sed -e 's/\s.*$//g')"
66 post_title=$(title_wrapper "$id") 70 post_title=$(title_wrapper "$id")
67 post_date=$(date -r "$file" "+%d/%m %Y") 71 post_date=$(date -r "$file" "+%d/%m %Y")
68 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date") 72 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$commit")
69 73
70 echo -ne "$post_link" >> docs/index.html 74 echo -ne "$post_link" >> docs/index.html
71 75
76 id="${id%.*}"
77 mkdir -p "docs/posts/$id"
72 esh -s /bin/bash \ 78 esh -s /bin/bash \
73 -o "docs/posts/${id%.*}.html" \ 79 -o "docs/posts/$id/index.html" \
74 "./post.esh" \ 80 "./post.esh" \
75 file="$file" \ 81 file="$file" \
76 date="$post_date" \ 82 date="$post_date" \