diff options
Diffstat (limited to 'generate.sh')
-rwxr-xr-x | generate.sh | 48 |
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 | |||
6 | INDEX_ART_LIMIT=1 | 6 | INDEX_ART_LIMIT=1 |
7 | INDEX_ART_COUNT=0 | 7 | INDEX_ART_COUNT=0 |
8 | 8 | ||
9 | title_wrapper() { | 9 | source ./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 | |||
15 | read_time() { | ||
16 | minu="$(eva -f 1 $1/150 | xargs)" | ||
17 | echo "$minu" | ||
18 | } | ||
19 | |||
20 | height() { | ||
21 | cm="$(eva -f 2 $1*18*0.0222 | xargs)" | ||
22 | echo "$cm" | ||
23 | } | ||
24 | 10 | ||
25 | link_wrapper() { | 11 | link_wrapper() { |
26 | # 1 - id | 12 | # 1 - id |
@@ -133,7 +119,7 @@ mkdir -p docs/art | |||
133 | cp -r ./art/* docs/art/ | 119 | cp -r ./art/* docs/art/ |
134 | 120 | ||
135 | 121 | ||
136 | cat << EOF | tee ./docs/posts/index.html ./docs/art/index.html ./docs/index.html > /dev/null | 122 | cat << 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 | |||
223 | echo "$(recent_link Art)" >> ./docs/index.html | 209 | echo "$(recent_link Art)" >> ./docs/index.html |
224 | 210 | ||
225 | # art | 211 | # art |
226 | echo -ne " | ||
227 | <h1>Art</h1> | ||
228 | <div class=\"separator\"></div> | ||
229 | <table> | ||
230 | " >> ./docs/art/index.html | ||
231 | 212 | ||
232 | echo | 213 | echo |
233 | echo "[+] ART" | 214 | echo "[+] ART" |
234 | 215 | ||
235 | for f in $art; do | 216 | esh \ |
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 | ||
220 | for 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 | |||
250 | echo "$(more_links art)" >> ./docs/index.html | 233 | echo "$(more_links art)" >> ./docs/index.html |
251 | 234 | ||
252 | # generate rss feeds | 235 | # generate rss feeds |
253 | echo "generating RSS feeds ..." | 236 | echo |
237 | echo "[+] Generating RSS feeds ..." | ||
254 | esh \ | 238 | esh \ |
255 | -o "./docs/index.xml" \ | 239 | -o "./docs/index.xml" \ |
256 | "rss.esh" | 240 | "rss.esh" |
257 | 241 | ||
258 | cat << EOF | tee -a ./docs/posts/index.html ./docs/art/index.html ./docs/index.html > /dev/null | 242 | cat << 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"> |