aboutsummaryrefslogtreecommitdiff
path: root/generate.sh
diff options
context:
space:
mode:
Diffstat (limited to 'generate.sh')
-rwxr-xr-xgenerate.sh48
1 files changed, 16 insertions, 32 deletions
diff --git a/generate.sh b/generate.sh
index 91c5e3b..83f5c88 100755
--- a/generate.sh
+++ b/generate.sh
@@ -6,21 +6,7 @@ INDEX_BLOG_COUNT=0
6INDEX_ART_LIMIT=1 6INDEX_ART_LIMIT=1
7INDEX_ART_COUNT=0 7INDEX_ART_COUNT=0
8 8
9title_wrapper() { 9source ./scripts.sh
10 # remove extension
11 # snake to title case
12 echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g"
13}
14
15read_time() {
16 minu="$(eva -f 1 $1/150 | xargs)"
17 echo "$minu"
18}
19
20height() {
21 cm="$(eva -f 2 $1*18*0.0222 | xargs)"
22 echo "$cm"
23}
24 10
25link_wrapper() { 11link_wrapper() {
26 # 1 - id 12 # 1 - id
@@ -133,7 +119,7 @@ mkdir -p docs/art
133cp -r ./art/* docs/art/ 119cp -r ./art/* docs/art/
134 120
135 121
136cat << EOF | tee ./docs/posts/index.html ./docs/art/index.html ./docs/index.html > /dev/null 122cat << EOF | tee ./docs/posts/index.html ./docs/index.html > /dev/null
137<!DOCTYPE html> 123<!DOCTYPE html>
138<html lang="en"> 124<html lang="en">
139<head> 125<head>
@@ -210,7 +196,7 @@ for f in $posts; do
210 mkdir -p "docs/posts/$id" 196 mkdir -p "docs/posts/$id"
211 esh \ 197 esh \
212 -o "docs/posts/$id/index.html" \ 198 -o "docs/posts/$id/index.html" \
213 "./post.esh" \ 199 post.esh \
214 file="$file" \ 200 file="$file" \
215 date="$post_date" \ 201 date="$post_date" \
216 title="$post_title" \ 202 title="$post_title" \
@@ -223,25 +209,22 @@ echo "$(more_links posts)" >> ./docs/index.html
223echo "$(recent_link Art)" >> ./docs/index.html 209echo "$(recent_link Art)" >> ./docs/index.html
224 210
225# art 211# art
226echo -ne "
227 <h1>Art</h1>
228 <div class=\"separator\"></div>
229 <table>
230 " >> ./docs/art/index.html
231 212
232echo 213echo
233echo "[+] ART" 214echo "[+] ART"
234 215
235for f in $art; do 216esh \
236 file="./art/"$f 217 -o "docs/art/index.html" \
237 id="${file##*/}" 218 art.esh
238 art_title=$(title_wrapper "$id")
239 art_date=$(date -r "$file" "+%d/%m — %Y")
240 art_post=$(art_block "$f" "$art_title" "$art_date")
241 echo "[~] $art_title"
242 echo -ne "$art_post" >> docs/art/index.html
243 219
220for f in $art; do
244 if [[ $INDEX_ART_COUNT -lt $INDEX_ART_LIMIT ]]; then 221 if [[ $INDEX_ART_COUNT -lt $INDEX_ART_LIMIT ]]; then
222 file="./art/"$f
223 id="${file##*/}"
224 art_title=$(title_wrapper "$id")
225 art_date=$(date -r "$file" "+%d/%m — %Y")
226 art_post=$(art_block "$f" "$art_title" "$art_date")
227 echo "[~] $art_title"
245 echo -ne "$art_post" >> ./docs/index.html 228 echo -ne "$art_post" >> ./docs/index.html
246 ((INDEX_ART_COUNT+=1)) 229 ((INDEX_ART_COUNT+=1))
247 fi 230 fi
@@ -250,12 +233,13 @@ done
250echo "$(more_links art)" >> ./docs/index.html 233echo "$(more_links art)" >> ./docs/index.html
251 234
252# generate rss feeds 235# generate rss feeds
253echo "generating RSS feeds ..." 236echo
237echo "[+] Generating RSS feeds ..."
254esh \ 238esh \
255 -o "./docs/index.xml" \ 239 -o "./docs/index.xml" \
256 "rss.esh" 240 "rss.esh"
257 241
258cat << EOF | tee -a ./docs/posts/index.html ./docs/art/index.html ./docs/index.html > /dev/null 242cat << EOF | tee -a ./docs/posts/index.html ./docs/index.html > /dev/null
259 </table> 243 </table>
260 <div class="separator"></div> 244 <div class="separator"></div>
261 <div class="footer"> 245 <div class="footer">