aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgenerate.sh45
1 files changed, 32 insertions, 13 deletions
diff --git a/generate.sh b/generate.sh
index 34ae4cb..7bbe3c1 100755
--- a/generate.sh
+++ b/generate.sh
@@ -7,11 +7,21 @@ title_wrapper() {
7 echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g" 7 echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g"
8} 8}
9 9
10read_time() {
11 minu="$(eva -f 1 $1/150 | xargs)"
12 echo "$minu"
13}
14
15height() {
16 cm="$(eva -f 2 $1*18*0.0222 | xargs)"
17 echo "$cm"
18}
19
10link_wrapper() { 20link_wrapper() {
11 # 1 - id 21 # 1 - id
12 # 2 - title 22 # 2 - title
13 # 3 - date 23 # 3 - date
14 # 4 - commit hash 24 # 4 - read time
15 echo -ne " 25 echo -ne "
16 <div class=\"post\"> 26 <div class=\"post\">
17 <div class=\"date\"> 27 <div class=\"date\">
@@ -20,11 +30,12 @@ link_wrapper() {
20 <a href=\"/posts/$1\" class=\"post-link\"> 30 <a href=\"/posts/$1\" class=\"post-link\">
21 <span class=\"post-link\">$2</span> 31 <span class=\"post-link\">$2</span>
22 </a> 32 </a>
23 <span class=\"commit-hash\"> 33 <div class="stats">
24 <a href=\"https://github.com/nerdypepper/site/blob/master/posts/$1.md\" style=\"text-decoration: none\"> 34 <span class=\"stats-number\">
25 $4 35 $4
26 </a> 36 </span>
27 </span> 37 <span class="stats-unit">min</span>
38 </div>
28 </div> 39 </div>
29 " 40 "
30} 41}
@@ -50,6 +61,7 @@ echo "
50echo " 61echo "
51<body> 62<body>
52<h1 class=\"heading\">n</h1> 63<h1 class=\"heading\">n</h1>
64<h4 class=\"date\">nerdypepper's μblog</h4>
53" >> docs/index.html 65" >> docs/index.html
54 66
55 67
@@ -70,10 +82,16 @@ for f in $posts; do
70 82
71 # generate posts 83 # generate posts
72 html=$(lowdown "$file") 84 html=$(lowdown "$file")
73 commit="$(git log -n1 --oneline "$file" | sed -e 's/\s.*$//g')" 85 stats=$(wc "$file")
86 words="$(echo $stats | awk '{print $2}')"
87 lines="$(echo $stats | awk '{print $1}')"
88
89 r_time="$(read_time $words)"
90 height="$(height $lines)"
91
74 post_title=$(title_wrapper "$id") 92 post_title=$(title_wrapper "$id")
75 post_date=$(date -r "$file" "+%d/%m %Y") 93 post_date=$(date -r "$file" "+%d/%m %Y")
76 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$commit") 94 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$r_time" "$height")
77 95
78 echo -ne "$post_link" >> docs/index.html 96 echo -ne "$post_link" >> docs/index.html
79 97
@@ -84,21 +102,22 @@ for f in $posts; do
84 "./post.esh" \ 102 "./post.esh" \
85 file="$file" \ 103 file="$file" \
86 date="$post_date" \ 104 date="$post_date" \
87 commit="$commit" \ 105 title="$post_title" \
88 title="$post_title" 106 read_time="$r_time" \
107 height="$height"
89 108
90done 109done
91 110
92echo " 111echo "
93<div class="separator"></div> 112<div class="separator"></div>
94<div class="footer"> 113<div class="footer">
95 <a href="https://github.com/nerdypepper"> Github </a> 114 <a href="https://github.com/nerdypepper">Github</a>
96 · 115 ·
97 <a href="https://twitter.com/N3rdyP3pp3r"> Twitter </a> 116 <a href="https://twitter.com/N3rdyP3pp3r">Twitter</a>
98 · 117 ·
99 <a href="mailto:[email protected]"> Mail </a> 118 <a href="mailto:[email protected]">Mail</a>
100 · 119 ·
101 <a href="https://linkedin.com/in/nerdypepper"> LinkedIn </a> 120 <a href="https://linkedin.com/in/nerdypepper">LinkedIn</a>
102</div> 121</div>
103</div> 122</div>
104</body> 123</body>