aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-02-23 06:50:20 +0000
committerAkshay <[email protected]>2021-02-23 06:50:20 +0000
commitcb5d00ef91736f184461906e335e24ab5243db8e (patch)
tree2da9980323cf0cc3250de895ea9e5992c17d5759
parentfa539a09d6a12dc479cc663e252c42e6c56df975 (diff)
modify script to generate site summary + art page
-rw-r--r--art/moonshine.pngbin0 -> 20634 bytes
-rw-r--r--art/onigiri.pngbin0 -> 5551 bytes
-rw-r--r--art/please_do_not_feed_the_animals.pngbin0 -> 2435361 bytes
-rw-r--r--art/the_observer.pngbin0 -> 17556 bytes
-rwxr-xr-xgenerate.sh150
-rw-r--r--post.esh4
6 files changed, 134 insertions, 20 deletions
diff --git a/art/moonshine.png b/art/moonshine.png
new file mode 100644
index 0000000..aa8b145
--- /dev/null
+++ b/art/moonshine.png
Binary files differ
diff --git a/art/onigiri.png b/art/onigiri.png
new file mode 100644
index 0000000..a44dbe1
--- /dev/null
+++ b/art/onigiri.png
Binary files differ
diff --git a/art/please_do_not_feed_the_animals.png b/art/please_do_not_feed_the_animals.png
new file mode 100644
index 0000000..5ceea55
--- /dev/null
+++ b/art/please_do_not_feed_the_animals.png
Binary files differ
diff --git a/art/the_observer.png b/art/the_observer.png
new file mode 100644
index 0000000..67f1929
--- /dev/null
+++ b/art/the_observer.png
Binary files differ
diff --git a/generate.sh b/generate.sh
index b246d61..5c556a0 100755
--- a/generate.sh
+++ b/generate.sh
@@ -1,6 +1,11 @@
1#! /usr/bin/env nix-shell 1#! /usr/bin/env nix-shell
2#! nix-shell -i bash -p eva pandoc esh 2#! nix-shell -i bash -p eva pandoc esh
3 3
4INDEX_BLOG_LIMIT=2
5INDEX_BLOG_COUNT=0
6INDEX_ART_LIMIT=1
7INDEX_ART_COUNT=0
8
4title_wrapper() { 9title_wrapper() {
5 # remove extension 10 # remove extension
6 # snake to title case 11 # snake to title case
@@ -42,33 +47,89 @@ link_wrapper() {
42 " 47 "
43} 48}
44 49
50more_links() {
51 # 1 - sub page
52 cat << EOF
53 <tr><td><a href="/$1" class="post-end-link">More ⟶ </a></td></tr>
54EOF
55}
56
57recent_link() {
58 # 1 - sub page
59 cat << EOF
60 <tr><td class="recent-heading"><span class="recent-heading">Recent $1</span></td></tr>
61EOF
62}
63
64art_block() {
65 # 1 - filename
66 # 2 - title
67 # 3 - date
68 echo -ne "
69 <tr>
70 <td class="table-post">
71 <div class=\"date\">
72 $3
73 </div>
74 <a href=\"/art/$1\" class=\"post-link\">
75 <span class=\"post-link\">$2</span>
76 </a>
77 </td>
78 <td class="table-stats">
79 <a href=\"/art/$1\">
80 <img src=\"/art/$1\" height="50px">
81 </a>
82 </td>
83 </tr>
84 "
85}
86
45intro() { 87intro() {
46 echo -ne " 88 echo -ne "
47 <div class="intro"> 89 <div class=\"intro\">
48 Hi. 90 Hi.
49 <div class="hot-links"> 91 <div class=\"hot-links\">
50 <a href="https://peppe.rs/index.xml" class="feed-button">Subscribe</a> 92 <a href=\"https://peppe.rs/index.xml\" class=\"feed-button\">Subscribe</a>
51 <a href="https://liberapay.com/nerdypepper/donate" class="donate-button">Donate</a> 93 <a href=\"https://liberapay.com/nerdypepper/donate\" class=\"donate-button\">Donate</a>
52 </div> 94 </div>
53 <p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p> 95 <p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p>
54 <p> 96 <p>
55 I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer. 97 I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer.
56 I write <a href="https://git.peppe.rs">open-source stuff</a> to pass time. 98 I write <a href=\"https://git.peppe.rs\">open-source stuff</a> to pass time.
57 I also design fonts: 99 I also design fonts:
58 <a href="https://git.peppe.rs/fonts/scientifica">scientifica</a>, 100 <a href=\"https://git.peppe.rs/fonts/scientifica\">scientifica</a>,
59 <a href="https://git.peppe.rs/fonts/curie">curie</a>. 101 <a href=\"https://git.peppe.rs/fonts/curie\">curie</a>.
60 </p> 102 </p>
61 <p>Send me a mail at [email protected] or a message at [email protected].</p> 103 <p>Send me a mail at [email protected] or a message at [email protected].</p>
62 </div> 104 </div>
63 " 105 "
64} 106}
65 107
66cat > ./docs/index.html << EOF 108n_logo() {
109 cat << EOF
110 <h1 class="heading">n</h1>
111 <h4 class="subheading">nerdypepper's μsings</h4>
112EOF
113}
114
115# setup dirs
116
117posts=$(ls -t ./posts)
118rm -rf "./docs/posts/"
119mkdir -p docs/posts
120
121art=$(ls -t ./art)
122rm -rf "./docs/art/"
123mkdir -p docs/art
124cp -r ./art/* docs/art/
125
126
127cat << EOF | tee ./docs/posts/index.html ./docs/art/index.html ./docs/index.html > /dev/null
67<!DOCTYPE html> 128<!DOCTYPE html>
68<html lang="en"> 129<html lang="en">
69<head> 130<head>
70<link rel="stylesheet" href="./style.css"> 131<link rel="stylesheet" href="/style.css">
71<link rel="alternate" type="application/atom+xml" title="nerdypepper's micro musings" href="./index.xml"> 132<link rel="alternate" type="application/atom+xml" title="nerdypepper's micro musings" href="/index.xml">
72<meta charset="UTF-8"> 133<meta charset="UTF-8">
73<meta name="viewport" content="initial-scale=1"> 134<meta name="viewport" content="initial-scale=1">
74<meta content="#ffffff" name="theme-color"> 135<meta content="#ffffff" name="theme-color">
@@ -79,20 +140,38 @@ cat > ./docs/index.html << EOF
79<meta property="og:url" content="https://peppe.rs"> 140<meta property="og:url" content="https://peppe.rs">
80<link rel="icon" type="image/x-icon" href="/favicon.png"> 141<link rel="icon" type="image/x-icon" href="/favicon.png">
81<title>peppe.rs</title> 142<title>peppe.rs</title>
143EOF
144
145# index
146echo
147echo "[+] INDEX"
148echo "$(n_logo)" >> ./docs/index.html
149
150cat << EOF | tee -a ./docs/posts/index.html ./docs/art/index.html > /dev/null
82<body> 151<body>
83 <h1 class="heading">n</h1>
84 <h4 class="subheading">nerdypepper's μsings</h4>
85 <div class="posts"> 152 <div class="posts">
86 <div class="post"> 153 <div class="post">
154 <a href="/" class="post-end-link">⟵ Back</a>
87EOF 155EOF
88 156
89echo -ne "$(intro)<table>" >> ./docs/index.html 157cat << EOF >> ./docs/index.html
158 <body>
159 <div class="posts">
160 <div class="post">
161 $(intro)
162 <table>
163 $(recent_link "Posts")
164EOF
90 165
91# posts 166# posts
92posts=$(ls -t ./posts) 167echo -ne "
93mkdir -p docs/posts 168 <h1>Blog</h1>
94rm -rf "./docs/posts/" 169 <div class=\"separator\"></div>
170 <table>
171 " >> ./docs/posts/index.html
95 172
173echo
174echo "[+] POSTS"
96for f in $posts; do 175for f in $posts; do
97 file="./posts/"$f 176 file="./posts/"$f
98 id="${file##*/}" # ill name my posts just fine 177 id="${file##*/}" # ill name my posts just fine
@@ -109,7 +188,12 @@ for f in $posts; do
109 echo "[~] $post_title" 188 echo "[~] $post_title"
110 post_date=$(date -r "$file" "+%d/%m — %Y") 189 post_date=$(date -r "$file" "+%d/%m — %Y")
111 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$r_time" "$height") 190 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$r_time" "$height")
112 echo -ne "$post_link" >> docs/index.html 191 echo -ne "$post_link" >> ./docs/posts/index.html
192
193 if [[ $INDEX_BLOG_COUNT -lt $INDEX_BLOG_LIMIT ]]; then
194 echo -ne "$post_link" >> ./docs/index.html
195 fi
196 ((INDEX_BLOG_COUNT+=1))
113 197
114 id="${id%.*}" 198 id="${id%.*}"
115 mkdir -p "docs/posts/$id" 199 mkdir -p "docs/posts/$id"
@@ -124,13 +208,43 @@ for f in $posts; do
124 intro="$(intro)" 208 intro="$(intro)"
125done 209done
126 210
211echo "$(more_links posts)" >> ./docs/index.html
212echo "$(recent_link Art)" >> ./docs/index.html
213
214# art
215echo -ne "
216 <h1>Art</h1>
217 <div class=\"separator\"></div>
218 <table>
219 " >> ./docs/art/index.html
220
221echo
222echo "[+] ART"
223
224for f in $art; do
225 file="./art/"$f
226 id="${file##*/}"
227 art_title=$(title_wrapper "$id")
228 art_date=$(date -r "$file" "+%d/%m — %Y")
229 art_post=$(art_block "$f" "$art_title" "$art_date")
230 echo "[~] $art_title"
231 echo -ne "$art_post" >> docs/art/index.html
232
233 if [[ $INDEX_ART_COUNT -lt $INDEX_ART_LIMIT ]]; then
234 echo -ne "$art_post" >> ./docs/index.html
235 ((INDEX_ART_COUNT+=1))
236 fi
237done
238
239echo "$(more_links art)" >> ./docs/index.html
240
127# generate rss feeds 241# generate rss feeds
128echo "generating RSS feeds ..." 242echo "generating RSS feeds ..."
129esh \ 243esh \
130 -o "./docs/index.xml" \ 244 -o "./docs/index.xml" \
131 "rss.esh" 245 "rss.esh"
132 246
133cat >> ./docs/index.html << EOF 247cat << EOF | tee -a ./docs/posts/index.html ./docs/art/index.html > /dev/null
134 </table> 248 </table>
135 <div class="separator"></div> 249 <div class="separator"></div>
136 <div class="footer"> 250 <div class="footer">
diff --git a/post.esh b/post.esh
index c2384b6..57dbab4 100644
--- a/post.esh
+++ b/post.esh
@@ -16,7 +16,7 @@
16 <body> 16 <body>
17 <div class="posts"> 17 <div class="posts">
18 <div class="post"> 18 <div class="post">
19 <a href="/" class="post-end-link">⟵ Back</a> 19 <a href="/posts" class="post-end-link">⟵ Back</a>
20 <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/<% basename $file%>">View Raw</a> 20 <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/<% basename $file%>">View Raw</a>
21 <div class="separator"></div> 21 <div class="separator"></div>
22 <div class="date"> 22 <div class="date">
@@ -40,7 +40,7 @@
40 <% pandoc --quiet -t html --highlight-style monochrome "$file" %> 40 <% pandoc --quiet -t html --highlight-style monochrome "$file" %>
41 </div> 41 </div>
42 <%= "$intro" %> 42 <%= "$intro" %>
43 <a href="/" class="post-end-link">⟵ Back</a> 43 <a href="/posts" class="post-end-link">⟵ Back</a>
44 <a class="stats post-end-link" href="https://raw.githubusercontent.com/nerdypepper/site/master/posts/<% basename $file%>">View Raw</a> 44 <a class="stats post-end-link" href="https://raw.githubusercontent.com/nerdypepper/site/master/posts/<% basename $file%>">View Raw</a>
45 </div> 45 </div>
46 </div> 46 </div>